REST over HTTP is client driven and stateless, as is the JAX-RS 2.0 API.
While this serves rather well for most cases, more and more there is a demand for asynchronous updates to recently received information, particularly using WebSockets. In addition, at time of GA of JAX-RS 2.1, Java SE 8 will be the current platform, with Java EE 8 being the next ambrella spec for JAX-RS. Java SE 8 provides a standard interface for typed asynchronous information streams in the package java.util.stream.
As WebSockets are simply and compatibly extending HTTP by a natural way to bring asynchronous updates to an HTTP enabled client, Stream is the natural way to deliver the provided updates as Java objects to the receiving party. As a consequence, utilizing WebSockets is the first-class technology to implement asynchronous updates in a RESTful HTTP environment, and Stream is the optimal interface to consume these.
As a consequence, it just makes sense to support the following combination:
@WebSockets
@GET
public java.util.stream.Stream get() {
// Asynchronously provide T instances on demand
}
REST over HTTP is client driven and stateless, as is the JAX-RS 2.0 API.
While this serves rather well for most cases, more and more there is a demand for asynchronous updates to recently received information, particularly using WebSockets. In addition, at time of GA of JAX-RS 2.1, Java SE 8 will be the current platform, with Java EE 8 being the next ambrella spec for JAX-RS. Java SE 8 provides a standard interface for typed asynchronous information streams in the package java.util.stream.
As WebSockets are simply and compatibly extending HTTP by a natural way to bring asynchronous updates to an HTTP enabled client, Stream is the natural way to deliver the provided updates as Java objects to the receiving party. As a consequence, utilizing WebSockets is the first-class technology to implement asynchronous updates in a RESTful HTTP environment, and Stream is the optimal interface to consume these.
As a consequence, it just makes sense to support the following combination:
@WebSockets @GET public java.util.stream.Stream get() {
// Asynchronously provide T instances on demand
}
Affected Versions
[2.0]