Class ManagedFilterPipeline

java.lang.Object
com.google.inject.servlet.ManagedFilterPipeline
All Implemented Interfaces:
FilterPipeline

class ManagedFilterPipeline extends Object implements FilterPipeline
Central routing/dispatch class handles lifecycle of managed filters, and delegates to the servlet pipeline.
  • Field Details

  • Constructor Details

  • Method Details

    • collectFilterDefinitions

      private FilterDefinition[] collectFilterDefinitions(Injector injector)
      Introspects the injector and collects all instances of bound List<FilterDefinition> into a master list.

      We have a guarantee that Injector.getBindings() returns a map that preserves insertion order in entry-set iterators.

    • initPipeline

      public void initPipeline(javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException
      Specified by:
      initPipeline in interface FilterPipeline
      Throws:
      javax.servlet.ServletException
    • dispatch

      public void dispatch(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain proceedingFilterChain) throws IOException, javax.servlet.ServletException
      Specified by:
      dispatch in interface FilterPipeline
      Throws:
      IOException
      javax.servlet.ServletException
    • withDispatcher

      private javax.servlet.ServletRequest withDispatcher(javax.servlet.ServletRequest servletRequest, ManagedServletPipeline servletPipeline)
      Used to create an proxy that dispatches either to the guice-servlet pipeline or the regular pipeline based on uri-path match. This proxy also provides minimal forwarding support.

      We cannot forward from a web.xml Servlet/JSP to a guice-servlet (because the filter pipeline is not called again). However, we can wrap requests with our own dispatcher to forward the *other* way. web.xml Servlets/JSPs can forward to themselves as per normal.

      This is not a problem cuz we intend for people to migrate from web.xml to guice-servlet, incrementally, but not the other way around (which, we should actively discourage).

    • destroyPipeline

      public void destroyPipeline()
      Specified by:
      destroyPipeline in interface FilterPipeline