0

I am using Jersey RESTful web services. I have below resource.

@Path("/banker/{location}")
@Component
public class BankResource{  

    @GET
    @Path("/{id}")
    @Produces({MediaType.APPLICATION_XML})
    @Override
    public Response getBankerByID(@PathParam("id") String id) {

          //some logic

      }


}

In above class how can i get the value of {location} ? Because based on {location} value i need to do some processing. Is it possible to get its value?

Thanks!

user755806
  • 6,565
  • 27
  • 106
  • 153

1 Answers1

1

You can get the location value using @PathParam and map it to method parameter as follows. `

@Path("/banker/{location}")
@Component
public class BankResource{  

    @GET
    @Path("/{id}")
    @Produces({MediaType.APPLICATION_XML})
    @Override
    public Response getBankerByID(@PathParam("location") String location,
@PathParam("id") String id) {
   //your code here
}

`

svjn
  • 904
  • 2
  • 19
  • 35