The first issue can be workarounded by using the following
JVM parameter for GlassFish:
[-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true]
For the second one (encoded/decoded path mismatch) I am going to try
the solution suggested bellow by Paul.
I am going to update the corresponding bug report [1] as well.
~Jakub
[1]
https://jersey.dev.java.net/issues/show_bug.cgi?id=17
On Fri, Oct 19, 2007 at 01:30:26PM +0200, Jakub Podlesak wrote:
>
> If my netbeans debuger works fine, there is also an issue that for
> http://localhost:8080/HelloWorldWebApp/myresource;url=httpwww.yahoo.com
> [com.sun.ws.rest.impl.container.servlet.HttpRequestAdaptor#initiateUriInfo]
> is invoked, but for
> http://localhost:8080/HelloWorldWebApp/myresource;url=http%3A%2Fwww.yahoo.com
> it is not (invoked).
>
> The same issue exist even for [com.sun.ws.rest.spi.container.servlet.ServletContainer#service].
> (The very same breakpoint which gets hit via the former request does not get hit for
> the latter one). Running on GF v2.
>
> The 404 response i can get only when i ask for
> http://localhost:8080/HelloWorldWebApp/myresource;url=http%3A/www.yahoo.com
>
>
> ~Jakub
>
> On Fri, Oct 19, 2007 at 12:08:19PM +0200, Paul Sandoz wrote:
> > This is because
> >
> > com.sun.ws.rest.impl.container.servlet.HttpRequestAdaptor
> >
> > works from decoded path.
> >
> > It needs to consistently work from the encoded path and avoid calling
> > servlet.getPathInfo (which is buggy on some servlet implementations).
> >
> > This is a little tricky because servlet does not directly support access
> > to the context, servlet and path info in encoded form.
> >
> > For now we can probably get away with constructing a decoded base path
> > from the context path and servlet path and then encoding it, as such
> > paths are unlikely to have round trip issues (and we can detect if they
> > do and throw an error).
> >
> > Once the encoded base path is obtained it should be easy to extract the
> > encoded path from the encoded base path and request URI (which in
> > encoded form), since the latter should begin with the former.
> >
> >
> > Part of larger problem is we don't yet have automated tests set up for
> > servlet containers. We will be making some steps to improve this area
> > soon. The end result i would like to see is the ability to create a unit
> > test module that contains client code, service code (independent of
> > container) such that it can be deployed tested on any supported HTTP
> > container.
> >
> > Paul.
> >
> > Jakub Podlesak wrote:
> > >Hi Hien,
> > >
> > >Thank you for finding this out. On a http container it works fine,
> > >while on a servlet container it fails as you describe (tested on Tomcat,
> > >Glassfish).
> > >(Well, I got 400 instead of 404; not happy with that anyway)
> > >
> > >I need to get some sleep. Tomorow I will look at it more detail.
> > >If you want, please file a bug at [1] and attach your webapp as a
> > >reproducible test case.
> > >Thanks.
> > >
> > >~Jakub
> > >
> > >[1]https://jersey.dev.java.net/issues/
> > >
> > >On Thu, Oct 18, 2007 at 02:51:13PM -0700, Hien Luu wrote:
> > >>Hi,
> > >>
> > >>I have a resource class that takes a matrix parameter and the value is a
> > >>URL like 'http://www.yahoo.com'. Obviously the URL is URL encoded on the
> > >>client side before making a GET request.
> > >>
> > >>This is what it looks like on the client side:
> > >>http://localhost:8080/myresource;url=http%3A%2F%2Fwww.yahoo.com>
> > >>
> > >>When the above request URL gets to the server side, it will look
> > >>something like this:
> > >>http://localhost:8080/myresource;url=http://www.yahoo.com
> > >>
> > >>The WebApplicationImpl.stripMatrixParams() method doesn't seem to parse
> > >>the above URL correctly.
> > >>
> > >>For example if the input to the method stripMatrixParams() is
> > >>'/myresource;url=http://www.yahoo.com', the output is
> > >>'/myresource//www.yahoo.com'. Because of this the
> > >>RootResourceClass.dispatch() method will not able to find a
> > >>UriTemplateDispatcher and ends up being a 404 response.
> > >>
> > >>Has anyone encounter this problem before?
> > >>
> > >>Thanks,
> > >>
> > >>Hien
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > >For additional commands, e-mail: users-help_at_jersey.dev.java.net
> > >
> >
> > --
> > | ? + ? = To question
> > ----------------\
> > Paul Sandoz
> > x38109
> > +33-4-76188109
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>