jsr370-experts@jax-rs-spec.java.net

RE: How is an SSE method selected

From: Markus KARG <markus_at_headcrashing.eu>
Date: Sat, 14 Nov 2015 15:36:51 +0100

Well actually if you are returning a stream of books instead of a single book I in fact would prefer to say the result should be Provider<Book>.

 

From: Sergey Beryozkin [mailto:sberyozkin_at_talend.com]
Sent: Samstag, 14. November 2015 13:37
To: jsr370-experts_at_jax-rs-spec.java.net
Subject: Re: How is an SSE method selected

 

Hi Markus, well, if we are talking about reusing the existing matching system, then we can have a method returning Book as opposed to SSEOutputChannel, on the same path, and thus being an equal candidate and thus the ambiguity will be there.
Santiago's response makes it clear, so I agree no issue is there

Cheers, Sergey


On 13/11/15 17:02, Markus KARG wrote:

Why shouldn't it? SSE is *no* special case in JAX-RS if I understood the Oracle proposal correctly: All the work (keeping the session open) is done *explicitly* by the application programmer. There simply seems to be *no* magic at all.

 

From: Sergey Beryozkin [mailto:sberyozkin_at_talend.com]
Sent: Donnerstag, 12. November 2015 22:57
To: jsr370-experts_at_jax-rs-spec.java.net
Subject: Re: How is an SSE method selected

 

Really ? So if no Accept is set by a browser client then a JAX-RS method that does not initiate an SSE output channel can be selected ?

Sergey
On 12/11/15 18:22, Markus KARG wrote:

As it is no special case at all, it simply is selected in case it is the best matching method.

 

From: Sergey Beryozkin [mailto:sberyozkin_at_talend.com]
Sent: Donnerstag, 12. November 2015 13:12
To: jsr370-experts_at_jax-rs-spec.java.net
Subject: How is an SSE method selected

 

Hi All

It is somewhat related to the earlier discussion.
From SSE [1]:

http://www.w3.org/TR/2009/WD-eventsource-20091029/#processing-model

"For HTTP connections, the Accept header may be included; if included, it must contain only formats of event framing that are supported by the user agent (one of which must be text/event-stream <http://www.w3.org/TR/2009/WD-eventsource-20091029/#text-event-stream> , as described below)."

So, if Accept: text/event-stream is included, I can see how having @Produces(text/event-stream) can indeed help in relying on the existing JAX-RS mechanism to ensure that the relevant method is selected.

However, the language above implies that it is optional to have Accept for initiating an SSE channel. What happens if Accept is omitted - how will the method be selected in that case ?

Thanks, Sergey