Log loaded values in config

Add/remove / in REST interface.
This commit is contained in:
Fabian Märki
2015-08-10 17:28:15 +02:00
parent c751aab8de
commit 776c8135e5
4 changed files with 20 additions and 13 deletions

View File

@ -84,7 +84,7 @@ There exist following fields:
### Example
```
curl -H "Content-Type: application/json" -X GET -d '{"channels":["channel1","channel2"],"startPulseId":0,"endPulseId":4}' http://sf-nube-14.psi.ch:8080/channels
curl -H "Content-Type: application/json" -X POST -d '{"channels":["channel1","channel2"],"startPulseId":0,"endPulseId":4}' http://sf-nube-14.psi.ch:8080/query
```
### Response example

View File

@ -1,5 +1,6 @@
package ch.psi.daq.queryrest.config;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.LinkedHashSet;
import java.util.List;
@ -131,6 +132,8 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
public Set<QueryField> defaultResponseFields() {
String[] responseFields =
StringUtils.commaDelimitedListToStringArray(env.getProperty(QUERYREST_DEFAULT_RESPONSE_FIELDS));
LOGGER.debug("Load '{}={}'", BEAN_NAME_DEFAULT_RESPONSE_FIELDS, Arrays.toString(responseFields));
// preserve order
LinkedHashSet<QueryField> defaultResponseFields = new LinkedHashSet<>(responseFields.length);
for (String field : responseFields) {
@ -148,6 +151,8 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
public Set<Aggregation> defaultResponseAggregations() {
String[] responseAggregations =
StringUtils.commaDelimitedListToStringArray(env.getProperty(QUERYREST_DEFAULT_RESPONSE_AGGREGATIONS));
LOGGER.debug("Load '{}={}'", BEAN_NAME_DEFAULT_RESPONSE_AGGREGATIONS, Arrays.toString(responseAggregations));
// preserve order
LinkedHashSet<Aggregation> defaultResponseAggregations = new LinkedHashSet<>(responseAggregations.length);
for (String aggregation : responseAggregations) {

View File

@ -70,6 +70,7 @@ public class QueryRestController {
@InitBinder
protected void initBinder(WebDataBinder binder) {
if (binder.getTarget() != null) {
if (requestProviderValidator.supports(binder.getTarget().getClass())) {
binder.addValidators(requestProviderValidator);
}
@ -77,6 +78,7 @@ public class QueryRestController {
binder.addValidators(queryValidator);
}
}
}
@RequestMapping(
value = CHANNELS,

View File

@ -53,7 +53,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
this.mockMvc.perform(
MockMvcRequestBuilders
.get("/" + QueryRestController.CHANNELS)
.get(QueryRestController.CHANNELS)
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultHandlers.print())
.andExpect(MockMvcResultMatchers.status().isOk())
@ -79,7 +79,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
this.mockMvc
.perform(MockMvcRequestBuilders
.post("/" + QueryRestController.QUERY)
.post(QueryRestController.QUERY)
.contentType(MediaType.APPLICATION_JSON)
.content(content))
@ -108,7 +108,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
String content = mapper.writeValueAsString(request);
this.mockMvc.perform(MockMvcRequestBuilders
.post("/" + QueryRestController.QUERY)
.post(QueryRestController.QUERY)
.contentType(MediaType.APPLICATION_JSON)
.content(content))
@ -142,7 +142,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
this.mockMvc
.perform(
MockMvcRequestBuilders
.post("/" + QueryRestController.QUERY)
.post(QueryRestController.QUERY)
.contentType(MediaType.APPLICATION_JSON)
.content(content)
)
@ -174,7 +174,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
String content = mapper.writeValueAsString(request);
this.mockMvc
.perform(MockMvcRequestBuilders.post("/" + QueryRestController.QUERY)
.perform(MockMvcRequestBuilders.post(QueryRestController.QUERY)
.contentType(MediaType.APPLICATION_JSON)
.content(content))