Pages

Wednesday, January 15, 2014

REST, SSE or WebSockets on WebLogic 10.3.6

WebLogic 10.3.6 comes with Jersey1.9 and has no support for Server Side Events or WebSockets. But for one of our projects we are making a HTML5 / AngularJS application, which need to invoke some RESTful services and we also want to use of SSE or WebSockets.
Off course we can use WebLogic 12.1.2 but we already have an OSB / SOA Suite WebLogic 10.3.6 environment.

So when you want to pimp your WebLogic 11g server you can make a new shared library which has the latest version of Jersey (1.18),  Jackson, Linking and the Atmosphere Jersey module ( for  SSE & Websockets).  Atmosphere also comes with a WebLogic addon ( cause Servlet 3.0 is not supported on WebLogic 10.3.6 ).
The Atmosphere framework also supports IE 6 or higher and when SSE or WebSockets is not supported by your browser,  it automatically falls back to Long Polling.

Here you can download the shared library and it comes with a working demo Rest Service and SSE chat application.


Just deploy this war as a Library and target this to a managed server.

In a Web Application add the weblogic.xml deployment descriptor to the web-inf folder and add a reference to this shared library.



Next step is to create a Rest Application which contains references to your jersey classes.


And for example a Jersey Atmosphere SSE chat service.


And the web.xml which contains the Jersey Servlet (with Jackson and Linking) and the Atmosphere Servlet with the WebLogic servlet class. org.atmosphere.weblogic.AtmosphereWebLogicServlet



When we start or deploy this application, we should get this output

Atmosphere is using async support: org.atmosphere.weblogic.WebLogicCometSupport running under container: WebLogic Server

We can test our RESTful service



or Test Server Side Events .


Here you can download the shared library or the demo application https://github.com/biemond/weblogic_11-Jersey-Atmosphere