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

[jsr339-experts] Re: Fwd: [javaee-spec users] [jsr342-experts] Server-Sent Events in Java EE 8

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Thu, 22 May 2014 15:54:01 +0100

Hi Santiago

Thanks for the link.
So hopefully SSE will be supported in JAX-RS 2.1.

What concerns me is this: appears like the decision to use a 'special'
media type is already taken, the way the presentation talks about it,
and as such the expectations are already there in EE8 team that yeah,
this is how it will work.

I hope we can take a different approach. @Produce will define a format
of the event stream field. The same way it defines the content of HTTP
payload which is part of the bigger HTTP response. The acceptance of
text/event-stream will be enabled by an SSE enabler annotation. IMHO
this will be more JAX-RS friendly. We would even use Response with
EventSource. Open question: how to tell the consumer about a field
format, guess SSE allows for custom headers/extensions, may be 'comment'
can be used as a container.

If the 'special' @Produces does stay then we will not help users at all
because the format of the field will have no associated metadata, so the
field can be a plain text or JSON, the 3rd party client won't know. That
said, perhaps in this case, EventOutput would have a way to set
Content-Type of the field. This approach still looks less JAX-RS friendly

Cheers, Sergey


On 22/05/14 14:35, Santiago Pericas-Geertsen wrote:
> Dear Experts,
>
> I'm forwarding a message from Bill Shannon in relation to SSE in EE 8.
> Please take a look as this may have an impact on our future work.
>
> -- Santiago
>
> Begin forwarded message:
>
>> *From: *Bill Shannon <bill.shannon_at_oracle.com
>> <mailto:bill.shannon_at_oracle.com>>
>> *Subject: **[javaee-spec users] [jsr342-experts] Server-Sent Events in
>> Java EE 8*
>> *Date: *May 21, 2014 at 8:14:46 PM EDT
>> *To: *jsr342-experts_at_javaee-spec.java.net
>> <mailto:jsr342-experts_at_javaee-spec.java.net>
>> *Reply-To: *jsr342-experts_at_javaee-spec.java.net
>> <mailto:jsr342-experts_at_javaee-spec.java.net>
>>
>> One of the items we'd like to add support for in Java EE 8 is
>> Server-Sent Events. We've considered several options for how
>> to add this support and concluded that JAX-RS seems like the best
>> choice. Santiago (JAX-RS spec lead) has written up the options
>> and our conclusion here:
>> https://java.net/projects/javaee-spec/downloads/download/SSE-in-EE8.pdf
>>
>> Please let us know if you have any concerns with including SSE
>> support in JAX-RS. Otherwise, expect to see this proposed in the
>> next JAX-RS JSR, to be submitted this summer.
>>
>> Thanks.
>>
>> Bill
>