extensions/servlet/src/com/google/inject/servlet/ManagedFilterPipeline.java
@SuppressWarnings({"JavaDoc", "deprecation"})
  private ServletRequest withDispatcher(
      ServletRequest servletRequest, final ManagedServletPipeline servletPipeline) {

    // don't wrap the request if there are no servlets mapped. This prevents us from inserting our
    // wrapper unless it's actually going to be used. This is necessary for compatibility for apps
    // that downcast their HttpServletRequests to a concrete implementation.
    if (!servletPipeline.hasServletsMapped()) {
      return servletRequest;
    }

    HttpServletRequest request = (HttpServletRequest) servletRequest;
    //noinspection OverlyComplexAnonymousInnerClass
    return new HttpServletRequestWrapper(request) {

      @Override
      public RequestDispatcher getRequestDispatcher(String path) {
        final RequestDispatcher dispatcher = servletPipeline.getRequestDispatcher(path);

        return (null != dispatcher) ? dispatcher : super.getRequestDispatcher(path);
      }
    };
  }
@SuppressWarnings({"JavaDoc", "deprecation"})
  private ServletRequest withDispatcher(
      ServletRequest servletRequest, final ManagedServletPipeline servletPipeline) {

    // don't wrap the request if there are no servlets mapped. This prevents us from inserting our
    // wrapper unless it's actually going to be used. This is necessary for compatibility for apps
    // that downcast their HttpServletRequests to a concrete implementation.
    if (!servletPipeline.hasServletsMapped()) {
      return servletRequest;
    }

    HttpServletRequest request = (HttpServletRequest) servletRequest;
    //noinspection OverlyComplexAnonymousInnerClass
    return new HttpServletRequestWrapper(request) {

      @Override
      public RequestDispatcher getRequestDispatcher(String path) {
        final RequestDispatcher dispatcher = servletPipeline.getRequestDispatcher(path);

        return (null != dispatcher) ? dispatcher : super.getRequestDispatcher(path);
      }
    };
  }
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.

<p>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.

<p>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).