Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-10613

Warning message when accessing endpoint in deployment with two Application subclasses with same @Path

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 14.0.0.Beta2
    • None
    • None
    • None
    • This issue was not found to be in RESTEasy. It is recommended in comments to talk to the Undertow team

      Warning message could be logged, if deployment contains two Application subclass with same @ApplicationPath and same @Path annotation in their end-points.

      One deployment contains two application subclasses with the same @ApplicationPath:

      @ApplicationPath("a")
      public class DuplicitePathDupliciteApplicationOne extends Application {
          @Override
          public Set<Class<?>> getClasses() {
              HashSet<Class<?>> set = new HashSet<Class<?>>();
              set.add(DuplicitePathDupliciteResourceOne.class);
              return set;
          }
      }
      
      @ApplicationPath("a")
      public class DuplicitePathDupliciteApplicationTwo extends Application {
          @Override
          public Set<Class<?>> getClasses() {
              HashSet<Class<?>> set = new HashSet<Class<?>>();
              set.add(DuplicitePathDupliciteResourceTwo.class);
              return set;
          }
      }
      

      And each has resource with the same @Path:

      @Path("/b")
      public class DuplicitePathDupliciteResourceOne {
          public static final String DUPLICITE_RESPONSE = "response4";
      
          @Path("/c")
          @GET
          @Produces(MediaType.TEXT_PLAIN)
          public String duplicite() {
              return DUPLICITE_RESPONSE;
          }
      }
      
      @Path("/b")
      public class DuplicitePathDupliciteResourceTwo {
          public static final String DUPLICITE_RESPONSE = "response5";
      
          @Path("/c")
          @GET
          @Produces(MediaType.TEXT_PLAIN)
          public String dupliciteOne() {
              return DUPLICITE_RESPONSE;
          }
      }
      

      With the request:

      Response response = client.target("http://localhost:8080/DuplicitePathTest/a/b/c").request().get();
      

      Warning in the server log should be logged as two different resources matches the request.

      See the test in the upstream testsuite - org.jboss.resteasy.test.response.DuplicitePathTest.testDuplicationTwoAppTwoResourceSameMethodPath() (excluded from running with testsuite by default)

            kanovotn Katerina Odabasi (Inactive)
            kanovotn Katerina Odabasi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: