@Test public void createContainerRequest_HeadersGiven_ShouldExpandHeaders() { Map<String, String> requestHeaders = ImmutableMap.of("hk0", "hv0", "hk1", "hv1"); WebActionRequest request = minimalRequestBuilder() .setHeaders(requestHeaders) .build(); JRestlessContainerRequest containerRequest = handler.createContainerRequest(request); assertEquals(ImmutableMap.of("hk0", Collections.singletonList("hv0"), "hk1", Collections.singletonList("hv1")), containerRequest.getHeaders()); }
@Override protected JRestlessContainerRequest createContainerRequest(WebActionRequest request) { requireNonNull(request); final String httpMethod = requireNonNull(request.getMethod(), "httpMethod must be given").toUpperCase(); final String body = request.getBody(); final Map<String, String> requestHeaders = request.getHeaders(); final Map<String, List<String>> containerRequestHeaders; if (requestHeaders == null) { containerRequestHeaders = Collections.emptyMap(); } else { containerRequestHeaders = HeaderUtils.expandHeaders(request.getHeaders()); } InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } final RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(request); return new DefaultJRestlessContainerRequest(requestAndBaseUri, httpMethod, entityStream, containerRequestHeaders); }
WebActionRequestHandler extends SimpleRequestHandler<WebActionRequest, JsonObject> { @Override protected JRestlessContainerRequest createContainerRequest(WebActionRequest request) { requireNonNull(request); final String httpMethod = requireNonNull(request.getMethod(), "httpMethod must be given").toUpperCase(); final String body = request.getBody(); final Map<String, String> requestHeaders = request.getHeaders(); final Map<String, List<String>> containerRequestHeaders; if (requestHeaders == null) { containerRequestHeaders = Collections.emptyMap(); } else { containerRequestHeaders = HeaderUtils.expandHeaders(request.getHeaders()); } InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } final RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(request); return new DefaultJRestlessContainerRequest(requestAndBaseUri, httpMethod, entityStream, containerRequestHeaders); } }
WebActionRequestHandler extends SimpleRequestHandler<WebActionRequest, JsonObject> { @Override protected JRestlessContainerRequest createContainerRequest(WebActionRequest request) { requireNonNull(request); final String httpMethod = requireNonNull(request.getMethod(), "httpMethod must be given").toUpperCase(); final String body = request.getBody(); final Map<String, String> requestHeaders = request.getHeaders(); final Map<String, List<String>> containerRequestHeaders; if (requestHeaders == null) { containerRequestHeaders = Collections.emptyMap(); } else { containerRequestHeaders = HeaderUtils.expandHeaders(request.getHeaders()); } InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } final RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(request); return new DefaultJRestlessContainerRequest(requestAndBaseUri, httpMethod, entityStream, containerRequestHeaders); }  }
WebActionRequestHandler extends SimpleRequestHandler<WebActionRequest, JsonObject> { @Override protected JRestlessContainerRequest createContainerRequest(WebActionRequest request) { requireNonNull(request); final String httpMethod = requireNonNull(request.getMethod(), "httpMethod must be given").toUpperCase(); final String body = request.getBody(); final Map<String, String> requestHeaders = request.getHeaders(); final Map<String, List<String>> containerRequestHeaders; if (requestHeaders == null) { containerRequestHeaders = Collections.emptyMap(); } else { containerRequestHeaders = HeaderUtils.expandHeaders(request.getHeaders()); } InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } final RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(request); return new DefaultJRestlessContainerRequest(requestAndBaseUri, httpMethod, entityStream, containerRequestHeaders); }  JsonObject delegateJsonRequest(@Nonnull JsonObject request); }
WebActionRequestHandler extends SimpleRequestHandler<WebActionRequest, JsonObject> { @Override protected JRestlessContainerRequest createContainerRequest(WebActionRequest request) { requireNonNull(request); final String httpMethod = requireNonNull(request.getMethod(), "httpMethod must be given").toUpperCase(); final String body = request.getBody(); final Map<String, String> requestHeaders = request.getHeaders(); final Map<String, List<String>> containerRequestHeaders; if (requestHeaders == null) { containerRequestHeaders = Collections.emptyMap(); } else { containerRequestHeaders = HeaderUtils.expandHeaders(request.getHeaders()); } InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } final RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(request); return new DefaultJRestlessContainerRequest(requestAndBaseUri, httpMethod, entityStream, containerRequestHeaders); }  JsonObject delegateJsonRequest(@Nonnull JsonObject request);  }