Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-959

Sub-resources locator failing inconsistently

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.0.5.Final
    • 3.0.1.Final
    • jaxrs
    • None

    Description

      In RESTEasy 2.3.2 sub resources can be defined in separate files, but in RESTEasy 3.0.1 under certain conditions this functionality no longer works.

      For example, the following code works fine in version 2.3.2:

      UserResource.java
      @Path("users")
      public interface UserResource {
          @GET
          @Path("{userID}")
          public UserData getUser(@PathParam("userID") String userID);
      }
      
      UserCertResource.java
      @Path("users/{userID}/certs")
      public interface UserCertResource {
          @GET
          public UserCertCollection findUserCerts(
               @PathParam("userID") String userID);
      }
      
      UserMembershipResource.java
      @Path("users/{userID}/memberships")
      public interface UserMembershipResource {
          @GET
          public UserMembershipCollection findUserMemberships(
              @PathParam("userID") String userID);
      }
      

      In version 3.0.1 RESTEasy can still locate UserCertResource but not UserMembershipResource. If the UserMembershipResource is merged into UserResource it will work, but strangely UserCertResource no longer works. So the workaround is to merge all sub resources into the parent:

      UserResource.java
      @Path("users")
      public interface UserResource {
          @GET
          @Path("{userID}")
          public UserData getUser(@PathParam("userID") String userID);
      
          @GET
          @Path("{userID}/certs")
          public UserCertCollection findUserCerts(
              @PathParam("userID") String userID);
      
          @GET
          @Path("{userID}/memberships")
          public UserMembershipCollection findUserMemberships(
              @PathParam("userID") String userID);
      }
      

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            edewata Endi Dewata
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: