Hi,
You are using a very old version of Jersey/JAX-RS because the
annotations are for a pre-standardized version of JAX-RS
Have you tried Jersey 1.0 or 1.0.1?
https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.1/jersey/dependencies.html
The following should work if using Jersey 1.0.x:
@Path("/instru/")
public class Instru {
@GET
@Path("/testUriInfo")
@Produces("text/plain")
public String listQueryParamNames(@Context UriInfo info){
...
I do not understand what you mean when you say "i don't know how to
compose the url to access the resource
when the method param is @Context.".
Do you mean that injection of @Context UriInfo is not working for
method parameters. Or do you mean that you do not know what to do with
the UriInfo once you have an injected instance?
The use of @Context UriInfo does not affect the path to the resource.
The @Path annotation declares the path, in your example "<BASE_URI>/
instru/testUriInfo", if you call info.getRequestUri() in your resource
method you will get the complete URI of the request.
Paul.
On Jan 13, 2009, at 2:49 AM, enzo 660 wrote:
> Hello Folks,
> I've been able to inject UriInfo into a class field but I'm not
> sure how to go about method params.
> Basically, i don't know how to compose the url to access the resource
> when the method param is @Context.
>
> @Path("/instru/")
> public class Instru
>
> @HttpMethod(GET)
> @Path("/testUriInfo")
> @ProduceMime("text/plain")
> public String listQueryParamNames(@Context UriInfo info){
> ...
>
> Can anybody please help with this?
>
> thanks,
> -RP
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>