felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] Updated: (FELIX-2774) HTTP Servlet RequestDispatcher 'forward' has invalid request pathInfo
Date Wed, 12 Jan 2011 04:45:45 GMT

     [ https://issues.apache.org/jira/browse/FELIX-2774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Felix Meschberger updated FELIX-2774:

    Attachment: FELIX-1962-listeners.patch

Simple patch against the HTTP Base module:

  - Removes the Request Wrapper overwriting getRequestURI method from the game
  - Adds a ServletHandler.handleInclude method which calls the Servlet's service method
      without the ServletHandlerRequestWrapper (on the grounds that the path related getter
      methods must return the same values)
  - Adds a resetBuffer() call to the forward method

What's still missing is the management of the request attributes mandated by the Servlet API

Shall we go this route ? Any takers to hack on the request attribute provisioning ?

> HTTP Servlet RequestDispatcher 'forward' has invalid request pathInfo
> ---------------------------------------------------------------------
>                 Key: FELIX-2774
>                 URL: https://issues.apache.org/jira/browse/FELIX-2774
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.0.4
>            Reporter: David Hay
>            Assignee: Felix Meschberger
>         Attachments: FELIX-1962-listeners.patch
> I'm trying to have one servlet forward to another servlet.  However, the forwarding doesn't
seem to work.
> I've set up the proxy servlet in my web.xml as follows (and this is the only servlet...no
filters defined)
>     <servlet>
>         <servlet-name>osgi-servlet-bridge</servlet-name>
>         <servlet-class>org.apache.felix.http.proxy.ProxyServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>osgi-servlet-bridge</servlet-name>
>         <url-pattern>/*</url-pattern>
>     </servlet-mapping>
> I then have two bundles, each registers a servlet under a different path (e.g. bundle
A registers under alias '/a' and bundle B registers under alias '/b') using the whiteboard
pattern.  The implementation of servlet A ends up doing this:
> RequestDispatcher rd = request.getRequestDispatcher("/b/some/path");
> rd.forward(request, response);
> This finds the ServletHandler for servlet B just fine, but gets hung up in the 'handle'
method. I think this is due to the implementation of the internal RequestWrapper class in
the ServletPipeline class.  This implementation overrides the getRequestURI method with the
passed in value.  However, ServletHandler.handle passed the result of HttpServletRequest.getPathInfo()
to the 'matches' method as a final check to make sure that the servlet should be invoked.
 Since the RequestWrapper class does not override getPathInfo, it returns the value from the
original request....which is '/a' in my example.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message