jax-rs-spec
  1. jax-rs-spec
  2. JAX_RS_SPEC-404

Clarify class scanning requirements with and without servlet

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None

      Description

      The following paragraphs in the specification are somewhat confusing and can lead to different interpretations:

      ==========
      An implementation MAY provide alternate mechanisms for locating resource classes and providers (e.g. runtime class scanning) but use of Application is the only portable means of configuration.

      It is RECOMMENDED that implementations support the Servlet 3 framework pluggability mechanism to enable portability between containers and to avail themselves of container-supplied class scanning facilities. When using the pluggability mechanism the following conditions MUST be met:
      If no Application subclass is present, JAX-RS implementations are REQUIRED to dynamically add a servlet and set its name to javax.ws.rs.core.Application and to automatically discover all root resource classes and providers which MUST be packaged with the application.

      When an Application subclass is present in the archive, if both Application.getClasses and Application.getSingletons return an empty collection 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 by scanning a .war file as described above.

      The annotation @Provider is used by a JAX-RS runtime to automatically discover provider classes via mechanisms such as class scanning. A JAX-RS implementation that supports automatic discovery of classes MUST process only those classes that are annotated with @Provider.
      ==========

      The intent was to make class scanning a requirement only when running on top of servlet (and using the pluggability mechanism). However, the text above can be interpreted as implying that class scanning is required in other cases.

        Activity

        Hide
        Santiago Pericas-Geertsen added a comment -

        Consider making class scanning mandatory in all environments that support web applications. This would be a stronger requirement than only supporting this when using the servlet pluggability mechanism.

        Show
        Santiago Pericas-Geertsen added a comment - Consider making class scanning mandatory in all environments that support web applications. This would be a stronger requirement than only supporting this when using the servlet pluggability mechanism.

          People

          • Assignee:
            Unassigned
            Reporter:
            Santiago Pericas-Geertsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: