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

Cannot set servlet-mapping for custom Application subclass

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 7.1.0.DR9
    • REST
    • None
      • mvn clean package
      • deploy
      • curl -v "http://localhost:8080/numbers/resources/numbers"

      Jaxrs-rs doesn't detect sevlet-mapping, with custom path, specified in web.xml when custom Application subclass is used.

      JAX-RS 2.0 specification requires to jax-rs implementations to recognize mapping in web.xml file. See section "2.3.2 Servlet"

      When I deploy attached reproducer. I get this resource available:

      [standalone@localhost:9990 /] /deployment=numbers.war/subsystem=jaxrs:read-resource(include-runtime=true,recursive=true)
      {
          "outcome" => "success",
          "result" => {"rest-resource" => {"com.airhacks.NumbersResource" => {
              "resource-class" => "com.airhacks.NumbersResource",
              "rest-resource-paths" => [{
                  "resource-path" => "numbers",
                  "consumes" => undefined,
                  "produces" => ["application/json"],
                  "java-method" => "javax.json.JsonArray com.airhacks.NumbersResource.numbers()",
                  "resource-methods" => ["GET /numbers/resources/numbers"]
              }],
              "sub-resource-locators" => undefined
          }}}
      }
      

      Accessing the resource returns:

      curl -v "http://localhost:8080/numbers/resources/numbers"
      ...
      < HTTP/1.1 404 Not Found
      

      Workaround exists - add context-param into web.xml to make the mapping available:

      <context-param>
              <param-name>resteasy.servlet.mapping.prefix</param-name>
              <param-value>/resources</param-value>
      </context-param>
      

      This is not regression against EAP 6.4

              rsearls r searls
              kanovotn Katerina Odabasi
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: