@Test public void createContainerRequest_NoBodyGiven_ShouldUseEmptyBaos() { GatewayRequestAndLambdaContext request = createMinimalRequest(); JRestlessContainerRequest containerRequest = gatewayHandler.createContainerRequest(request); InputStream is = containerRequest.getEntityStream(); assertEquals(ByteArrayInputStream.class, is.getClass()); assertEquals("", toString((ByteArrayInputStream) is)); }
@Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } protected  GatewayRequestHandler(); }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } protected  GatewayRequestHandler();  }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } protected  GatewayRequestHandler();   }