use of com.yahoo.jdisc.http.servlet.ServletRequest in project vespa by vespa-engine.
the class ServletFilterRequestTest method newServletRequest.
private ServletRequest newServletRequest() throws Exception {
MockHttpServletRequest parent = new MockHttpServletRequest("GET", uri.toString());
parent.setProtocol(Version.HTTP_1_1.toString());
parent.setRemoteHost(host);
parent.setRemotePort(port);
parent.setParameter(paramName, paramValue);
parent.setParameter(listParamName, listParamValue);
parent.addHeader(headerName, headerValue);
parent.setAttribute(attributeName, attributeValue);
HttpConnection connection = Mockito.mock(HttpConnection.class);
when(connection.getCreatedTimeStamp()).thenReturn(System.currentTimeMillis());
parent.setAttribute("org.eclipse.jetty.server.HttpConnection", connection);
return new ServletRequest(parent, uri);
}
use of com.yahoo.jdisc.http.servlet.ServletRequest in project vespa by vespa-engine.
the class SecurityFilterInvoker method invokeRequestFilterChain.
/**
* Returns the servlet request to be used in any servlets invoked after this.
*/
@Override
public HttpServletRequest invokeRequestFilterChain(RequestFilter requestFilterChain, URI uri, HttpServletRequest httpRequest, ResponseHandler responseHandler) {
SecurityRequestFilterChain securityChain = cast(SecurityRequestFilterChain.class, requestFilterChain).orElseThrow(SecurityFilterInvoker::newUnsupportedOperationException);
ServletRequest wrappedRequest = new ServletRequest(httpRequest, uri);
securityChain.filter(new ServletFilterRequest(wrappedRequest), responseHandler);
return wrappedRequest;
}
Aggregations