Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add streamProxy method to container handler #118

Closed
sapessi opened this issue Feb 6, 2018 · 2 comments
Closed

Add streamProxy method to container handler #118

sapessi opened this issue Feb 6, 2018 · 2 comments

Comments

@sapessi
Copy link
Collaborator

sapessi commented Feb 6, 2018

  • Framework version: 1.0
  • Implementations: Jersey / Spring / Spring Boot / Spark

Add a new streamProxy(InputStream, OutputStream, Context) method to the LambdaContainerHandler object.

Scenario

Simplifies the task of writing Lambda RequestStreamHandler` classes from:

@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
			throws IOException {
	AwsProxyRequest request = LambdaContainerHandler.getObjectMapper().readValue(inputStream, AwsProxyRequest.class);
	AwsProxyResponse resp = handler.proxy(request, context);
	LambdaContainerHandler.getObjectMapper().writeValue(outputStream, resp);
        outputStream.close();
}

to:

@Override
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
			throws IOException {
	handler.streamProxy(inputStream, outputStream, context);
}
@sapessi
Copy link
Collaborator Author

sapessi commented Feb 10, 2018

Added proxyStream method. Leaving this open until docs is updated.

sapessi added a commit that referenced this issue Feb 11, 2018
…and moved them all to the new streamProxy method (#118).
@sapessi
Copy link
Collaborator Author

sapessi commented Feb 13, 2018

I've committed the updated docs in the next-release branch of the wiki. Closing this issue.

@sapessi sapessi closed this as completed Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant