users@jersey.java.net

Re: Matrix Parameter With URL Value Ends Up With 404

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Fri, 19 Oct 2007 00:53:52 +0200

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