Search in sources :

Example 1 with FilterInvoker

use of com.yahoo.jdisc.http.server.jetty.FilterInvoker in project vespa by vespa-engine.

the class JDiscFilterForServletTest method bindings.

private Module bindings(BindingRepository<RequestFilter> requestFilters, BindingRepository<ResponseFilter> responseFilters) {
    return Modules.combine(new AbstractModule() {

        @Override
        protected void configure() {
            bind(FilterBindings.class).toInstance(new FilterBindings(requestFilters, responseFilters));
            bind(FilterInvoker.class).toInstance(new FilterInvoker() {

                @Override
                public HttpServletRequest invokeRequestFilterChain(RequestFilter requestFilter, URI uri, HttpServletRequest httpRequest, ResponseHandler responseHandler) {
                    TestRequestFilter filter = (TestRequestFilter) requestFilter;
                    filter.runAsSecurityFilter(httpRequest, responseHandler);
                    return httpRequest;
                }

                @Override
                public void invokeResponseFilterChain(ResponseFilter responseFilter, URI uri, HttpServletRequest request, HttpServletResponse response) {
                    TestResponseFilter filter = (TestResponseFilter) responseFilter;
                    filter.runAsSecurityFilter(request, response);
                }
            });
        }
    }, guiceModule());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ResponseHandler(com.yahoo.jdisc.handler.ResponseHandler) FilterInvoker(com.yahoo.jdisc.http.server.jetty.FilterInvoker) ResponseFilter(com.yahoo.jdisc.http.filter.ResponseFilter) HttpServletResponse(javax.servlet.http.HttpServletResponse) FilterBindings(com.yahoo.jdisc.http.server.FilterBindings) URI(java.net.URI) RequestFilter(com.yahoo.jdisc.http.filter.RequestFilter) AbstractModule(com.google.inject.AbstractModule)

Aggregations

AbstractModule (com.google.inject.AbstractModule)1 ResponseHandler (com.yahoo.jdisc.handler.ResponseHandler)1 RequestFilter (com.yahoo.jdisc.http.filter.RequestFilter)1 ResponseFilter (com.yahoo.jdisc.http.filter.ResponseFilter)1 FilterBindings (com.yahoo.jdisc.http.server.FilterBindings)1 FilterInvoker (com.yahoo.jdisc.http.server.jetty.FilterInvoker)1 URI (java.net.URI)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1