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

Sub-resources locator failing inconsistently

XMLWordPrintable

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

      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);
      }
      

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

              Created:
              Updated:
              Resolved: