Prefix bug in Seam integration of RESTEasy
------------------------------------------
Key: JBSEAM-4360
URL:
https://jira.jboss.org/jira/browse/JBSEAM-4360
Project: Seam
Issue Type: Bug
Affects Versions: 2.1.2.GA
Reporter: Stephane Epardaud
The default way Seam integrates with RESTEasy is by mapping REST
resources to the default path "/app/seam/resource/rest/..." but there is
something fishy going on since calling
uriInfo.getBaseUriBuilder().path(MyResourceClass.class,
"getUser").build("2") on this resource:
@Name("RESTUsers")
@Path("/")
public class MyResourceClass {
@GET
@Path("/user/{userId}")
public Response getUser(@PathParam("userId") String identifier) {...}
}
Produces this URI:
http://localhost/app/user/2 instead of
http://localhost/app/seam/resource/rest/user/2
Funny thing is that the required path info is stripped from the URI in
org.jboss.seam.resteasy.ResteasyResourceAdapter.extractUriInfo on
purpose (there is a comment about it and a setting to disable this that
breaks the application since it requires this path to be written in
@Path annotations for some weird reason).
I think the proper way to do it is to keep this path since it is
required for generating inter-resource URIs and make sure RESTEasy uses
it as a prefix when registering REST resource URIs. This should be done
when registering resources by calling
getDispatcher().getRegistry().setRootPath("/seam/resource/rest") so that
@Path("/user/{userId}") will match the prefixed URIs without having to
hard-code the prefix in there.
At the moment it's quite hard to generate responses for HTTP CREATED.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira