• Post Reply Bookmark Topic Watch Topic
  • New Topic

@PathParam and @QueryParam not working if added both in same resource method argument.

 
Nasiruddin Shaikh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using jersey 1.18 for the REST service.
I have the following REST resource method.

@GET
@Path("servicedetails/{serviceId}")
@Produces({ MediaType.APPLICATION_JSON })
public Response getServiceDetails(@PathParam("serviceId") String serviceId,
@QueryParam("getProps") boolean getProps) {
@SuppressWarnings("unchecked")
Service service = catalogService.getService(serviceId, getProps);
return Response.ok(service, MediaType.APPLICATION_JSON).build();
// return Response.ok().build();
}

On debuggin i see that the following get url
http://localhost:9998/catalogservices/catalog/servicedetails/7?getProps=true
sets the value of the following argumens
serviceId to "7?getProps=true" and
getProps to "true"

I am confused why for the pathparam argument is getting the value of both pathparam and queryparam values. Any help highly appreciated.



 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Jersey 2.x and Spring Rest, there is NO issue.

Check your client code and re-test again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!