use of com.yahoo.jdisc.http.HttpRequest in project vespa by vespa-engine.
the class FilterTestCase method requireThatRequestFilterChainIsRun.
@Test
public void requireThatRequestFilterChainIsRun() throws Exception {
final RequestFilter requestFilter1 = mock(RequestFilter.class);
final RequestFilter requestFilter2 = mock(RequestFilter.class);
final RequestFilter requestFilterChain = RequestFilterChain.newInstance(requestFilter1, requestFilter2);
final HttpRequest request = null;
final ResponseHandler responseHandler = null;
requestFilterChain.filter(request, responseHandler);
verify(requestFilter1).filter(any(HttpRequest.class), any(ResponseHandler.class));
verify(requestFilter2).filter(any(HttpRequest.class), any(ResponseHandler.class));
}
use of com.yahoo.jdisc.http.HttpRequest 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.http.HttpRequest 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