Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

WebSocket Samples in GlassFish 4 build 66 - javax.websocket.* package: TOTD #190

$
0
0

This blog has published a few blogs on using JSR 356 Reference Implementation (Tyrus) integrated in GlassFish 4 promoted builds.
  • TOTD #183: Getting Started with WebSocket in GlassFish
  • TOTD #184: Logging WebSocket Frames using Chrome Developer Tools, Net-internals and Wireshark
  • TOTD #185: Processing Text and Binary (Blob, ArrayBuffer, ArrayBufferView) Payload in WebSocket
  • TOTD #186: Custom Text and Binary Payloads using WebSocket
  • TOTD #189: Collaborative Whiteboard using WebSocket in GlassFish 4
The earlier blogs created a WebSocket endpoint as:
import javax.net.websocket.annotations.WebSocketEndpoint;

@WebSocketEndpoint("websocket")
public class MyEndpoint {
. . .
Based upon the discussion in JSR 356 EG, the package names have changed to javax.websocket.*. So the updated endpoint definition will look like:
import javax.websocket.WebSocketEndpoint;

@WebSocketEndpoint("websocket")
public class MyEndpoint {
. . .
The POM dependency is:
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0-b09</version>
</dependency>

And if you are using GlassFish 4 build 66, then you also need to provide a dummy EndpointFactory implementation as:
import javax.websocket.WebSocketEndpoint;

@WebSocketEndpoint(value="websocket", factory=MyEndpoint.DummyEndpointFactory.class)
public class MyEndpoint {
 . . .   
class DummyEndpointFactory implements EndpointFactory {
    @Override
public Object createEndpoint() { return null; }
  }
}
This is only interim and will be cleaned up in subsequent builds. But I've seen couple of complaints about this already and so this deserves a short blog.

Have you been tracking the latest Java EE 7 implementations in GlassFish 4 promoted builds ?


Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>