users@jax-rs-spec.java.net

[jax-rs-spec users] Re: JAX-WS like Provider in JAX-RS

From: Markus KARG <markus_at_headcrashing.eu>
Date: Fri, 16 Jan 2015 18:52:12 +0100

Why not simply say that a request must be routet to an annotated method
first, and none is found, it is to be delivered to a default method, which
is either one declared as @Default, or is the sole public non-annotated
method, or will fail otherwise?

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin_at_talend.com]
Sent: Freitag, 16. Januar 2015 17:14
To: jsr370-experts_at_jax-rs-spec.java.net
Subject: Re: JAX-WS like Provider in JAX-RS

Alternatively, introduce an HttpMethod derived annotation meaning any
Http verb can match a given method. It might offer a much simpler
approach...

Sergey


On 16/01/15 16:10, Sergey Beryozkin wrote:
> Hi All,
>
> Happy New Year,
>
> I've seen a number of times users asking how to have a dynamic JAX-RS
> service which would support various HTTP methods but without having to
> annotate. Something like JAX-WS Provider [1].
>
> How about introducing javax.ws.rs.ServiceProvider interface:
>
> interface ServiceProvider {
> Response invoke(InputStream is);
> }
>
> The implementation can inject a JAX-RS Request context and get an HTTP
> verb name. UriInfo context will provide all the info about the request
> URI including path and query parameters, HttpHeaders - about headers.
> The injected Providers interface will help to read the stream into some
> concrete object for Post/Put requests if needed.
>
> If a given object implements ServiceProvider then the JAX-RS
> implementation will accept it as a service bean. @Path is defaulted to
> "" if no @Path is available.
>
> I think it can be introduced into a spec (API, text) fairly easy but I'm
> not expecting this proposal accepted easily too.
>
> Any comments ?
>
> Sergey
>
>
>
> [1] http://docs.oracle.com/javase/7/docs/api/javax/xml/ws/Provider.html