21 March 2014

Using JAX-RS 2.0 in WebLogic Server 12.1.3



Please note: this blog discusses WebLogic Server 12.1.3
which has not yet been released.

We've been working on adding some Java API updates to the coming WebLogic Server 12.1.3 release.

One that I think is going to be very popular is JAX-RS 2.0, which includes some useful new capabilities around filtering, interception and a really useful new client API.

 In the WebLogic Server 12.1.3 release we are providing this in the form of an optional shared-library that contains: the JAX-RS 2.0 API, a Jersey 2.x implementation, some common Jersey extensions such as media support and a utility that works to expose the JAX-RS 2.0 API to referencing applications.

To make use of it, developers first deploy the jax-rs-2.0.war shared-library from the $ORACLE_HOME/wlserver/common/deployable-libraries directory to the server (or cluster) then use it in an application by referencing it as a library using a weblogic deployment descriptor.

Using the library-name and specification-version attributes from the JSF library, an example of a weblogic.xml to use it would be (lines:8-11):

<?xml version="1.0" encoding="UTF-8"?>  
<weblogic-web-app>  
    <jsp-descriptor>  
        <keepgenerated>true</keepgenerated>  
        <debug>true</debug>  
    </jsp-descriptor>  
    <context-root>/service-centre</context-root>  
    <library-ref>  
        <library-name>jax-rs</library-name>  
        <specification-version>2.0</specification-version>  
    </library-ref>  
</weblogic-web-app>  

No comments: