Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-8068

jax-rs doesn't work correctly if HttpServletDispatcher is used and application class doesn't return end-point classes by getClasses method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 7.1.0.DR9
    • REST
    • None

      Description of problem:
      jax-rs doesn't work correctly if HttpServletDispatcher is used and application class doesn't return end-point classes by getClasses method

      RESTEasy doesn't detect end-point classes in application, if this classes are not specified in Application class. But specifying of end-points in application class is not necessary, if HttpServletDispatcher is not used as servlet in web.xml.

      Steps to Reproduce:

      1. mvn package
      2. deploy
      3. curl -v http://localhost:8080/jaxrs-wf/test/text

      Actual results:

      [mkopecky@dhcp-10-40-5-21 bin]$ curl -v http://localhost:8080/jaxrs-wf/test/text
      *   Trying ::1...
      * connect to ::1 port 8080 failed: Connection refused
      *   Trying 127.0.0.1...
      * Connected to localhost (127.0.0.1) port 8080 (#0)
      > GET /jaxrs-wf/test/text HTTP/1.1
      > Host: localhost:8080
      > User-Agent: curl/7.43.0
      > Accept: */*
      > 
      < HTTP/1.1 404 Not Found
      < Connection: keep-alive
      < X-Powered-By: Undertow/1
      < Server: JBoss-EAP/7
      < Content-Length: 0
      < Date: Wed, 04 Jan 2017 13:24:10 GMT
      < 
      * Connection #0 to host localhost left intact
      [mkopecky@dhcp-10-40-5-21 bin]$ 
      

      Workaround:
      Define all end-points in application class:

      @ApplicationPath("/")
      public class TestApplication extends Application {
          public static Set<Class<?>> classes = new HashSet<Class<?>>();
      
          @Override
          public Set<Class<?>> getClasses() {
              classes.add(SimpleService.class);
              return classes;
          }
      }
      

              rsearls r searls
              mkopecky@redhat.com Marek Kopecky
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: