Skip to content

Instantly share code, notes, and snippets.

@aparnachaudhary
Created April 30, 2014 15:45
Show Gist options
  • Save aparnachaudhary/271fd156f16dacb24e9f to your computer and use it in GitHub Desktop.
Save aparnachaudhary/271fd156f16dacb24e9f to your computer and use it in GitHub Desktop.
JAX-RS Resource specification and implementation conflicts

JAX-RS Resource and use of @Path

Based on JAX-RS specification; @Path annotation is not mandatory on Resource classes. But many implementations seem to deviate from the specification. But shouldn’t reference implementation adhere to the specification?

JAX-RS 2.0 spec:

Resource classes are POJOs that have at least one method annotated with @Path or a request method designator.

RESTEasy:

2.3.5

UserDoc The @javax.ws.rs.Path annotation must exist on either the class and/or a resource method.

Implementation is broken in jboss-as-7.1.1.Final. @Path is mandatory at class level.

3.0.6

UserDoc The @javax.ws.rs.Path annotation must exist on either the class and/or a resource method.

Works as documented with wildfly-8.0.0.Final.

But seems to be broken with Tomcat 7. @Path is mandatory at class level. RESTEASY-1017

Jersey - JAX-RS Reference implementation:

Documentation Root resource classes are POJOs (Plain Old Java Objects) that are annotated with @Path have at least one method annotated with @Path or a resource method designator annotation such as @GET, @PUT, @POST, @DELETE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment