@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Path("{component}")
    public Response setConfigs(@PathParam("component") String component,
                               @DefaultValue("false") @QueryParam("preset") boolean preset,
                               InputStream request) throws IOException {
        ComponentConfigService service = get(ComponentConfigService.class);
        ObjectNode props = readTreeFromStream(mapper(), request);
        List<String> errorMsgs = new ArrayList<String>();
        if (preset) {
                props.fieldNames().forEachRemaining(k -> {
                    try {
                        service.preSetProperty(component, k, props.path(k).asText());
                    } catch (IllegalArgumentException e) {
                        errorMsgs.add(e.getMessage());
                    }
                });
        } else {
                props.fieldNames().forEachRemaining(k -> {
                    try {
                        service.setProperty(component, k, props.path(k).asText());
                    } catch (IllegalArgumentException e) {
                        errorMsgs.add(e.getMessage());
                    }
                });
        }
        if (!errorMsgs.isEmpty()) {
            return Response.status(MULTI_STATUS_RESPONE).entity(produceErrorJson(errorMsgs)).build();
        }
        return Response.ok().build();
    }
@Test
    public void setConfigs() {
        WebTarget wt = target();
        try {
            wt.path("configuration/foo").request().post(
                    Entity.json("{ \"k\" : \"v\" }"), String.class);
        } catch (BadRequestException e) {
            assertEquals("incorrect key", "foo", service.component);
            assertEquals("incorrect key", "k", service.name);
            assertEquals("incorrect value", "v", service.value);
        }
    }