|
From: Bill B. <bb...@re...> - 2012-10-23 18:27:44
|
On 10/23/2012 12:01 PM, David Kaspar wrote: > I am trying to use PathSegment to receive "an arbitrary set of > name-value pairs embedded in a uri path segment". I am following this > documentation: > > http://docs.jboss.org/resteasy/docs/2.3.5.Final/userguide/html_single/#_PathParam_and_PathSegment > > The endpoint in the example is defined as > @GET > @Path("/book/{id}") > public String getBook(@PathParam("id") PathSegment id) {...} > > And the given url is > GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke > > The problem is that this url format doesn't work for us (404, the > endpoint is not found). To make it work we had to include the / and a > placeholder like so: > GET http://host.com/library/book/id;name=EJB 3.0;author=Bill Burke > > Is the documentation correct and we are misusing PathSegment or is the > documentation incorrect? > You are misunderstanding how path expressions work @Path("/book/{id}") expects a segment after /book. I'd suggest an additional new method: @Path("/book") public String getBook(@MatixParam("name") String name, @MatrixParam("author") String author) {...} FYI, I don't use matrix parameters anymore. I've found that some non-Java URI parsing APIs don't parse them very well (particularly Python). I'd suggest using query parameters. -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |