users@jersey.java.net

[Jersey] Re: _at_PathParam and _at_DefaultValue confusion

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 21 Mar 2012 08:48:11 +0100

Hello Paul,

that is actually bug in javadoc/spec - using @DefaultValue with
@PathParam is not supported (and won't be).

you should create two separate resource methods for @Path("/activate")
and @Path("/activate/{id}") or maybe use @QueryParam instead, but since
its id, solution with two methods seems to be better.

Regards,
Pavel

On 3/20/12 10:36 AM, paul.brickell_at_evolved-intelligence.com wrote:
> I have a simple service with a single GET method....
>
> Class hass @Path("activation")
>
> @GET
> @Path("/activate/{id}")
> @Produces("text/xml")
> public Response activate(@DefaultValue("null") @PathParam("id") String
> id)
> {
> ...
> }
>
> If I browse to http://localhost/context/activation/activate/123 all is
> well the service is invoked. If I browse to
> http://localhost/context/activation/activate I get a 404. I was
> expecting to get a call with the value "null". Did I miss something?
>