Multiple @PathParam

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple @PathParam

Julio Faerman
Hello,

I am trying to create a URL with 2 @PathParam, but it is not working.
With 1 it works fine.
The code is simple:

@ProduceMime({"application/xml","application/json"})
@Path("/someEntity/{entityId}/otherEntity/{otherId}")
public class EntityResource extends CebusResource{

       @GET
       public Entity getEntity(@PathParam("{entityId}") long
entityId,@PathParam("{otherId}") long otherId){
               System.out.println(entityId +" - "+otherId );
               return new Entity();
       }
}

I am getting the value 0 in both parameters. With only one it works
fine. I am using 0.8-ea.
Is this a issue or am i doing something wrong?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple @PathParam

Marc Hadley
On Jul 24, 2008, at 12:53 PM, Julio Faerman wrote:

>
> I am trying to create a URL with 2 @PathParam, but it is not working.
> With 1 it works fine.
> The code is simple:
>
> @ProduceMime({"application/xml","application/json"})
> @Path("/someEntity/{entityId}/otherEntity/{otherId}")
> public class EntityResource extends CebusResource{
>
>       @GET
>       public Entity getEntity(@PathParam("{entityId}") long
> entityId,@PathParam("{otherId}") long otherId){

You shouldn't include the '{' and '}' in the @PathParam values. Try:

public Entity getEntity(@PathParam("entityId") long  
entityId,@PathParam("otherId") long otherId)

instead.

Maybe your method with only one param doesn't have the {} in it ?

Marc.

>               System.out.println(entityId +" - "+otherId );
>               return new Entity();
>       }
> }
>
> I am getting the value 0 in both parameters. With only one it works
> fine. I am using 0.8-ea.
> Is this a issue or am i doing something wrong?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple @PathParam

Julio Faerman
Ops :(

Thank you very much !

On Thu, Jul 24, 2008 at 1:58 PM, Marc Hadley <[hidden email]> wrote:

> On Jul 24, 2008, at 12:53 PM, Julio Faerman wrote:
>>
>> I am trying to create a URL with 2 @PathParam, but it is not working.
>> With 1 it works fine.
>> The code is simple:
>>
>> @ProduceMime({"application/xml","application/json"})
>> @Path("/someEntity/{entityId}/otherEntity/{otherId}")
>> public class EntityResource extends CebusResource{
>>
>>      @GET
>>      public Entity getEntity(@PathParam("{entityId}") long
>> entityId,@PathParam("{otherId}") long otherId){
>
> You shouldn't include the '{' and '}' in the @PathParam values. Try:
>
> public Entity getEntity(@PathParam("entityId") long
> entityId,@PathParam("otherId") long otherId)
>
> instead.
>
> Maybe your method with only one param doesn't have the {} in it ?
>
> Marc.
>
>>              System.out.println(entityId +" - "+otherId );
>>              return new Entity();
>>      }
>> }
>>
>> I am getting the value 0 in both parameters. With only one it works
>> fine. I am using 0.8-ea.
>> Is this a issue or am i doing something wrong?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]