Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-4360

Prefix bug in Seam integration of RESTEasy

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.1.2.GA
    • Fix Version/s: 2.2.1.CR1
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                christian.bauer Christian Bauer
                Reporter:
                FroMage Stephane Epardaud
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: