This should be fixed now. There were a couple of issues to do with handling
URIs matching the base address of a given endpoint (for ex, in your example, it
would be http://host:9080/app/v1".
Example :
@Path("/")
public class Resource {
@Context
private UriInfo uriInfo;
@Path("{path:.*}")
public String getBaseAddressAndPathParam(@PathParam("path") String path) {
return uriInfo.getBaseUri().toString() + "," + path;
}
}
if we have an initial request ending with /app/v1 or /app/v1/ then
uriInfo.baseUri() was wrong. Interesting enough, starting the test with
/app/v1/test was enough to 'fix' the uriInfo.baseUri() issue. Note that this
issue was there only when we had a root @Path("/") but not with say
@Path("/root").
This issue was caused by ServletController not updating destinations when
initial request URIs were matching endpoint addresses.
There was a related issue to do with capturing the last path segment,
specifically, when the endpoint address was ending with /app/v1 but the request
uri was ending with "/app/v1/" and with root @Path("/").
It all has been fixed. Please try the latest snapshot, should be available
shortly
thanks, Sergey
-----Original Message-----
From: Bob Allison [mailto:[email protected]]
Sent: Fri 1/8/2010 1:02 PM
To: [email protected]
Subject: Re: Path Oddity with UriInfo
I don't have Tomcat 5 readily available here; I'll see if I get something set
up.
With the resource mapped to "/{path}":
-- The first test yields the same results
-- The second test loses the "/" at the end of the path
-- The third test yields the same results
-- The fourth test fails to find a resource for "/"
-- The last test fails to find a resource for "/app/v1"
Sergey Beryozkin wrote, On 1/8/10 11:30 AM:
> I've set up the test and will be looking into it now.
> Can you give me a favor and try with Tomcat 5 ? And also without a custom
> path regex ?
> I will be testing it all myself, but some independent tests can help.
> cheers, Sergey
>
> -----Original Message-----
> From: Bob Allison [mailto:[email protected]]
> Sent: Wed 1/6/2010 12:53 PM
> To: [email protected]
> Subject: Re: Path Oddity with UriInfo
>
> I have been using v2.2.5, and I just verified that the development trunk does
> the same thing.
>
> Thanks for your help.
>
>
> Sergey Beryozkin wrote, On 1/6/10 12:14 PM:
>> Not sure what is happening, I'll need to sign off shortly, but will look
>> into it tomorrow
>>
>> cheers, Sergey
>>
>>
>> -----Original Message-----
>> From: Bob Allison [mailto:[email protected]]
>> Sent: Wed 1/6/2010 11:59 AM
>> To: [email protected]
>> Subject: Path Oddity with UriInfo
>>
>> I have a JAX-RS application that I am deploying in Tomcat 6 using the
>> CXFNonSpringJaxrsServlet servlet class. The application deploys at context
>> "/app", the servlet is mapped to "/v1/*" and has a single resource mapped to
>> "/{path:.*}". The resource gets a UriInfo object injected.
>>
>> Right now, the resource simply displays UriInfo.getBaseUri and the path
>> parameter. I am using a browser to access the resource. When I deploy the
>> application, I access the following URIs (in order):
>>
>> URI | getBaseUri | path param
>> -------------+---------------------+-----------
>> /app/v1 | http://host/ | "v1"
>> /app/v1/ | http://host/ | "v1/"
>> /app/v1/test | http://host/app/v1/ | "test"
>> /app/v1/ | http://host/app/v1/ | ""
>> /app/v1 | http://host/app/v1/ | "app/v1"
>>
>> Am I doing something wrong?
>>
>>
>
>