use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class HttpRequestDispatch method handleRequest.
@SuppressWarnings("try")
private ServletRequestReader handleRequest() throws IOException {
HttpRequest jdiscRequest = HttpRequestFactory.newJDiscRequest(jDiscContext.container, servletRequest);
ContentChannel requestContentChannel;
try (ResourceReference ref = References.fromResource(jdiscRequest)) {
HttpRequestFactory.copyHeaders(servletRequest, jdiscRequest);
requestContentChannel = requestHandler.handleRequest(jdiscRequest, servletResponseController.responseHandler);
}
ServletInputStream servletInputStream = servletRequest.getInputStream();
ServletRequestReader servletRequestReader = new ServletRequestReader(servletInputStream, requestContentChannel, jDiscContext.janitor, metricReporter);
servletInputStream.setReadListener(servletRequestReader);
return servletRequestReader;
}
use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class HttpRequestDispatch method handleRequestFilterResponse.
ContentChannel handleRequestFilterResponse(Response response) {
try {
servletRequest.getInputStream().close();
ContentChannel responseContentChannel = servletResponseController.responseHandler.handleResponse(response);
servletResponseController.finishedFuture().whenComplete(completeRequestCallback);
return responseContentChannel;
} catch (IOException e) {
throw throwUnchecked(e);
}
}
use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class AccessLoggingRequestHandler method handleRequest.
@Override
public ContentChannel handleRequest(final Request request, final ResponseHandler handler) {
Preconditions.checkArgument(request instanceof HttpRequest, "Expected HttpRequest, got " + request);
final HttpRequest httpRequest = (HttpRequest) request;
httpRequest.context().put(CONTEXT_KEY_ACCESS_LOG_ENTRY, accessLogEntry);
final ResponseHandler accessLoggingResponseHandler = new AccessLoggingResponseHandler(httpRequest, handler, accessLogEntry);
final ContentChannel requestContentChannel = delegate.handleRequest(request, accessLoggingResponseHandler);
return requestContentChannel;
}
Aggregations