ATEST-266:
- adding a method for returning all dbmodes - temporary fix for ajax CORS call issue (see comment)
This commit is contained in:
@ -87,8 +87,7 @@ public class QueryRestController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = CHANNELS, method = {RequestMethod.GET, RequestMethod.POST},
|
@RequestMapping(value = CHANNELS, method = {RequestMethod.GET, RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public @ResponseBody Collection<String> getChannels(@RequestBody(required = false) ChannelsRequest request)
|
public @ResponseBody Collection<String> getChannels(@RequestBody(required = false) ChannelsRequest request)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
// in case not specified use default (e.g. GET)
|
// in case not specified use default (e.g. GET)
|
||||||
@ -113,8 +112,7 @@ public class QueryRestController {
|
|||||||
* @return Collection of channel names matching the specified input channel name
|
* @return Collection of channel names matching the specified input channel name
|
||||||
* @throws Throwable in case something goes wrong
|
* @throws Throwable in case something goes wrong
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = CHANNELS + "/{channelName}", method = {RequestMethod.GET},
|
@RequestMapping(value = CHANNELS + "/{channelName}", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public @ResponseBody Collection<String> getChannels(@PathVariable(value = "channelName") String channelName)
|
public @ResponseBody Collection<String> getChannels(@PathVariable(value = "channelName") String channelName)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
return getChannels(new ChannelsRequest(channelName));
|
return getChannels(new ChannelsRequest(channelName));
|
||||||
@ -126,8 +124,7 @@ public class QueryRestController {
|
|||||||
*
|
*
|
||||||
* @return list of {@link Ordering}s as String array
|
* @return list of {@link Ordering}s as String array
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "ordering", method = {RequestMethod.GET},
|
@RequestMapping(value = "ordering", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public @ResponseBody List<String> getOrderingValues() {
|
public @ResponseBody List<String> getOrderingValues() {
|
||||||
List<Ordering> orderings = Lists.newArrayList(Ordering.values());
|
List<Ordering> orderings = Lists.newArrayList(Ordering.values());
|
||||||
return orderings.stream()
|
return orderings.stream()
|
||||||
@ -141,8 +138,7 @@ public class QueryRestController {
|
|||||||
*
|
*
|
||||||
* @return list of {@link QueryField}s as String array
|
* @return list of {@link QueryField}s as String array
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "queryfields", method = {RequestMethod.GET},
|
@RequestMapping(value = "queryfields", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public @ResponseBody List<String> getQueryFieldValues() {
|
public @ResponseBody List<String> getQueryFieldValues() {
|
||||||
List<QueryField> orderings = Lists.newArrayList(QueryField.values());
|
List<QueryField> orderings = Lists.newArrayList(QueryField.values());
|
||||||
return orderings.stream()
|
return orderings.stream()
|
||||||
@ -156,8 +152,7 @@ public class QueryRestController {
|
|||||||
*
|
*
|
||||||
* @return list of {@link Aggregation}s as String array
|
* @return list of {@link Aggregation}s as String array
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "aggregations", method = {RequestMethod.GET},
|
@RequestMapping(value = "aggregations", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public @ResponseBody List<String> getAggregationsValues() {
|
public @ResponseBody List<String> getAggregationsValues() {
|
||||||
List<Aggregation> orderings = Lists.newArrayList(Aggregation.values());
|
List<Aggregation> orderings = Lists.newArrayList(Aggregation.values());
|
||||||
return orderings.stream()
|
return orderings.stream()
|
||||||
@ -171,8 +166,7 @@ public class QueryRestController {
|
|||||||
*
|
*
|
||||||
* @return list of {@link AggregationType}s as String array
|
* @return list of {@link AggregationType}s as String array
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "aggregationtypes", method = {RequestMethod.GET},
|
@RequestMapping(value = "aggregationtypes", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
produces = {MediaType.APPLICATION_JSON_VALUE})
|
|
||||||
public @ResponseBody List<String> getAggregationTypesValues() {
|
public @ResponseBody List<String> getAggregationTypesValues() {
|
||||||
List<AggregationType> orderings = Lists.newArrayList(AggregationType.values());
|
List<AggregationType> orderings = Lists.newArrayList(AggregationType.values());
|
||||||
return orderings.stream()
|
return orderings.stream()
|
||||||
@ -180,6 +174,20 @@ public class QueryRestController {
|
|||||||
return value.toString();
|
return value.toString();
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current list of {@link DBMode} values.
|
||||||
|
*
|
||||||
|
* @return list of {@link DBMode}s as String array
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "dbmodes", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
|
public @ResponseBody List<String> getDBModeValues() {
|
||||||
|
List<DBMode> orderings = Lists.newArrayList(DBMode.values());
|
||||||
|
return orderings.stream()
|
||||||
|
.map((DBMode value) -> {
|
||||||
|
return value.toString();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,6 +61,11 @@ public class CorsFilter extends OncePerRequestFilter {
|
|||||||
response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
||||||
response.addHeader("Access-Control-Allow-Headers", "Origin, Authorization, Accept, Content-Type");
|
response.addHeader("Access-Control-Allow-Headers", "Origin, Authorization, Accept, Content-Type");
|
||||||
response.addHeader("Access-Control-Max-Age", "1800");
|
response.addHeader("Access-Control-Max-Age", "1800");
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME zellweger_c: remove me once https://github.com/PolymerElements/iron-ajax/pull/147 has been merged!
|
||||||
|
response.addHeader("Access-Control-Expose-Headers", "X-JSON-Prefix");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user