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

subresources with jax-rs annos on superclass's interfaces

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Done
    • 2.2.2.GA
    • 2.3-beta-1
    • jaxrs
    • None
    • Hide

      Workaround is to manually push the interface method annotations down to the abstract implementation in the superclass.

      Show
      Workaround is to manually push the interface method annotations down to the abstract implementation in the superclass.

    Description

      In situations like this:

      interface SuperInt
      {
          @Path("foo")
          @GET
          @Produces("application/json")
          String getFoo();
      }
      
      abstract class SuperIntAbstract implements SuperInt
      {
          @Override
          public String getFoo()
          {
              return "Foo: " + getName();
          }
          protected abstract String getName();
      }
      
      @Path("/somewhere")
      class SomeOtherResource
      {
          @Path("superint")
          public SuperInt getSuperInt()
          {
              return new SuperIntAbstract()
              {
                  @Override
                  protected String getName()
                  {
                       return "Fred";
                   }
              };
          }
      }
      

      When a client accesses GET /somewhere/superint/foo, resteasy throws indicating that it doesn't think the returned type from getSuperInt() has JAX-RS annotations. In GetRestful.getSubResourceClass(), resteasy looks first up the superclass chain for JAX-RS annotations, then it looks only at the immediate class's interfaces and throws if they don't have JAX-RS annos.

      Is it possible that resteasy should examine superclass interfaces as well? What is the purpose of finding a single class with some jaxrs annotations? What if the class (or a superclass) implemented several interfaces that had different, but compatible annotations?

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            yarrumretep_jira Peter Murray (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: