On Nov 18, 2008, at 11:43 AM, António Mota wrote:
> Hello:
>
> I'm new in here, I'm developing a REST infrastructure for our internal
> applications based basically on Spring Integration. I only
> "discovered" Jersey in the middle of the project and started using
> parts of it, so now my project is a mix of SI and Jersey. Basically,
> SI for the communication and server-side handling and Jersey for the
> connectors/resources side.
>
> So in this context I have some questions:
>
> 1) It seems that Jersey is tightly coupled with Glassfish, in a way
> hat is only partially usable on other platforms, like in my case
> JBoss. For instance, UriInfo being a "injectable interface" will not
> work anywhere besides Glassfish, or am I wrong?
>
The annotations and injection rules are specified by JAX-RS so it  
should be portable across JAX-RS implementations. Thus Jersey should  
work in this respect with any app server.
> 2) I'm relying heavily on the Jersey annotations
Those are JAX-RS annotations, so again they are portable.
> and the
> AbtractResource and SubResources to match the templates with my
> resource's methods. I have a problem with this situation:
>
> 	@GET
> 	@Path("/data/{entity}/{key}")
> 	Object read(@PathParam("entity")String entity,  
> @PathParam("key")String key);
>
> 	@GET
> 	@Path("/data/query/{queryname}")
> 	Object getQuery(@PathParam("queryname")String queryName,
> @MatrixParam("queryparams")Map<String, String> params);
>
>
> From what I saw until now, the same URI will always be matched by
> these two paths, is there any way to distinguish between a "fixed"
> part of the uri and a "variable" one?
>
It should work, what version of Jersey have you tried?
The spec states:
   Sort E using the number of literal characters in each member as the  
primary key (descending order), the number of
   capturing groups as a secondary key (descending order) and the  
number of capturing groups with non-default regular
   expressions (i.e. not ‘([^ /]+?)’) as the tertiary key (descending  
order).
Thus the path template of "/data/query/{queryname}" will be sorted  
before "/data/{entity}/{key}" in terms of matching, because the former  
contains more literal characters than the latter. And therefore a path  
consisting of "<base>/data/query/params" will match the former template.
I notice you want to use matrix params. A Map is not supported for  
@MatrixParam [1]. If you want to get all matrix params associated with  
a path parameter you can do:
        @GET
        @Path("/data/query/{queryname}")
        Object getQuery(
            @PathParam("queryname") PathSegment ps);
Paul.
[1] 
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/MatrixParam.html