jakartaee / rest

Jakarta RESTful Web Services
Other
362 stars 117 forks source link

Alignment of "Convention over Configuration" / "Configuration By Exception" with other Java EE 6 APIs #76

Open glassfishrobot opened 13 years ago

glassfishrobot commented 13 years ago

JAX-RS 2.0 should behave (Configuration by Exception / Convention over Configuration) like JPA 2 / EJB 3.2 / CDI APIs:

1. The value of the @Path annotation should be derived from class / method name respectively 2. The default MediaType for @Consumes / @Produces should be MediaType.TEXT_PLAIN 3. There is no need for the specification of @Consumes / @Produces in case 2. 4. A single method (regardless of its name) in a resource / sub resource should be defaulted to a @GET request. 5... [TBD]

But: HTTP methods (@GET, @POST, @PUT ...) must not be automatically derived from method names.

See also: #64

Affected Versions

[1.1]

glassfishrobot commented 6 years ago
glassfishrobot commented 13 years ago

@glassfishrobot Commented Reported by abien

glassfishrobot commented 11 years ago

@glassfishrobot Commented @mpotociar said: Ad 1. The value of the @Path annotation should be derived from class / method name respectively

This is a good suggestion. However, there's a lot to agree upon yet:

  1. we need to agree on the method for deriving path value from the Java artifacts. My suggestion would be to use "camel-case to all lower-case, dash separated", e.g. BookStore -> book-store, customerAddress() -> customer-address. This approach produces URIs in a canonical form that is very readable and supports applying generic redirection filters that detect non-canonical URIs and canonicalize them (e.g. upper-case letters in URI, see for instance www.stackoverflow.com).
  2. we need to agree what to do with common prefixes and suffixes (Resource, get(), post*. My current suggestion would be to strip them out, but we need to come up with a complete set.
  3. etc.

Ad 2, 3. The default MediaType for @Consumes / @Produces should be MediaType.TEXT_PLAIN

There is a default value specified already and it would be BW incompatible to change it. I suggest we do not proceed with the proposed CoC in this area.

Ad 4. A single method (regardless of its name) in a resource / sub resource should be defaulted to a @GET request.

I'm a bit afraid of loosing some readability, but we may want to start experimenting with this in our implementations and see how users react to that. If the experiment proves to be successful, we may proceed with standardizing.

glassfishrobot commented 11 years ago

@glassfishrobot Commented @mpotociar said: Deferring for future release.

glassfishrobot commented 7 years ago

@glassfishrobot Commented ggam said: Related to point 2 and a more viable solution: #546

glassfishrobot commented 13 years ago

@glassfishrobot Commented Issue-Links: is duplicated by JAX_RS_SPEC-34 JAX_RS_SPEC-59 is related to JAX_RS_SPEC-18

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAX_RS_SPEC-71