final URI baseUri,
final URI requestUri,
final HttpServletRequest servletRequest,
final HttpServletResponse servletResponse) throws ServletException, IOException {
ContainerRequest requestContext = new ContainerRequest(baseUri, requestUri,
servletRequest.getMethod(), getSecurityContext(servletRequest), new ServletPropertiesDelegate(servletRequest));
requestContext.setEntityStream(servletRequest.getInputStream());
addRequestHeaders(servletRequest, requestContext);
// Check if any servlet filters have consumed a request entity
// of the media type application/x-www-form-urlencoded
// This can happen if a filter calls request.getParameter(...)
filterFormParameters(servletRequest, requestContext);
try {
final ResponseWriter responseWriter = new ResponseWriter(
forwardOn404,
servletResponse,
asyncExtensionDelegate.createDelegate(servletRequest, servletResponse),
backgroundTaskScheduler);
requestContext.setRequestScopedInitializer(new RequestScopedInitializer() {
@Override
public void initialize(ServiceLocator locator) {
locator.<Ref<HttpServletRequest>>getService((new TypeLiteral<Ref<HttpServletRequest>>() {
}).getType()).set(servletRequest);
locator.<Ref<HttpServletResponse>>getService((new TypeLiteral<Ref<HttpServletResponse>>() {
}).getType()).set(servletResponse);
}
});
requestContext.setWriter(responseWriter);
appHandler.handle(requestContext);
return Values.lazy(new Value<Integer>() {
@Override