Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1535

JAX-RS Subresource paths are chosen incorrectly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 7.0.0
    • 1.7.2, 7.0.0-M1
    • None
    • None

    Description

      When using a JAX-RS root resource with a subresource, the path of the subresources are evaluated in a wrong way.
      Consider following code:

      @Stateless
      @Path("/")
      public class RootResource {

      @Context
      ResourceContext resourceContext;

      @GET
      public String getRoot()

      { return "root"; }

      @Path("models")
      public ModelsResource models()

      { return resourceContext.getResource(ModelsResource.class); }

      }

      and:

      public class ModelsResource {

      @GET
      public String getAll()

      { return "all"; }

      @GET
      @Path("

      {id}")
      public String get(@PathParam("id") final String id) { return "model_" + id; }
      }

      The paths of the resources which TomEE evaluates are:
      /resources/ -> String getRoot()
      /resources/ -> String getAll()
      /resources/{id}

      -> String get(String)

      But the correct way due to the spec would be
      /resources/models/ -> getAll() and
      /resources/models/

      {id}

      -> get(String).

      Attachments

        Issue Links

          Activity

            People

              romain.manni-bucau Romain Manni-Bucau
              sdaschner Sebastian Daschner
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: