KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there a way to use this parameter style: /products/123;456;789 in JAX-RS with Jersey? If I use PathParam, only the first parameter in the list is returned. I tried to escape the semicolon but then Jersey returns only "123;456;789" as the value of the first parameter list entry I declared the GET method as public List<Product> getClichedMessage(@PathParam("ids") List<String> idList) Update: I am referring to the Jersey user guide for Jersey 1.1.5: In general the Java type of the method parameter may (...) 4) be List, Set or SortedSet, where T satisfies 2 or 3 above. The resulting collection is read-only. (...) Sometimes parameters may contain more than one value for the same name. If this is the case then types in 4) may be used to obtain all values. Update: here is my test code: package de.betabeans.resources; import java.util.List; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @Path("/test") public class TestResource { @GET @Path("/{ids}") @Produces({"text/plain"}) public String getClichedMessage(@PathParam("ids") List<String> idList) { return "size=" + idList.size(); } } Test URL with semicolon escaped: http://localhost:8080/resources/test/1%3B2%3B3 Update: the changelog for Jersey 1.3 include this information: Fixed issue 540 http://java.net/jira/browse/JERSEY-540 Para
Tags (comma-separated)
Save Edits
Cancel