Closed
Description
- Framework version: 1.1
- Implementations: Jersey
Scenario
Client > APi Gateway > Lambda.
When using JerseyLambdaContainerHandler proxyStream(inputStream, outputStream, context)
in a RequestStreamHandler implementation, query params are de-coded a second time before passed to the appropriate JAX-RS controller. This causes issues with strings containing +
, which are encoded as %2B
, decoded once as +
, but then decoded a second time as
.
Expected behavior
Passing %2B
in a query parameter from a client should reach the JAX-RS controller as +
.
Actual behavior
Passing %2B
in a query parameter from a client reaches the JAX-RS controller as
.
Steps to reproduce
Create an endpoint:
@GET
@Path("/test")
public Response getAll(@QueryParam("param") String param) {
...
}
Proxy the JAX-RS with a streaming lambda:
public class StreamLambdaHandler implements RequestStreamHandler {
private static final ResourceConfig jerseyApplication = new JerseyConfig();
private static final JerseyLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler = JerseyLambdaContainerHandler.getAwsProxyHandler(jerseyApplication);
@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
handler.proxyStream(inputStream, outputStream, context);
outputStream.close();
}
}
Expose the lambda via API Gateway. Make a request to GET /test?param=ab%2Bcd
.