jersey
  1. jersey
  2. JERSEY-1595

A case when autodiscovery of a root resource is not done

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-m10
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      Spec. Section 2.3.2 says:

      When an Application subclass is present in the archive, if both Application.getClasses and
      Application.getSingletons return an empty list then all root resource classes and providers
      packaged in the web application MUST be included and the JAX-RS implementation is REQUIRED
      to discover them automatically.

      With web.xml and no ApplicationPath, autodiscovery is not done

      web.xml:

      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
          <servlet>
              <servlet-name>AppConfig</servlet-name>
          </servlet>
          <servlet-mapping>
              <servlet-name>AppConfig</servlet-name>
              <url-pattern>/*</url-pattern>
          </servlet-mapping>
          <session-config>
              <session-timeout>30</session-timeout>
          </session-config>
      </web-app>
      

      AppConfig:

      public class AppConfig extends Application {
      /*
      It works when not commented out
      	public java.util.Set<java.lang.Class<?>> getClasses() {
      		Set<Class<?>> resources = new HashSet<Class<?>>();
      		resources.add(Resource.class);
      		return resources;
      	}
      */	
      }
      

      Resource:

      @Path("resource")
      public class Resource {
      	@GET
      	public String get(){
      		return new "OK";
      	}
      }
      

      All requests are answered with HTTP 404 Status.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 7 hours
              7h