You have two choices - you can put them both in the path or you can have one as a query parameter.
i.e. do you want it to look like:
/{id}/{name}
or
/{id}?name={name}
For the first one just do:
@GET
@Path("/{id}/{name}")
@Produces({MediaType.APPLICATION_XML})
public Person fetchPerson(
@PathParam("id") Integer id,
@PathParam("name") String name) {
return personService.fetchPerson(id);
}
For the second one just add the name as a RequestParam
. You can mix PathParam
s and RequestParam
s.