Java API for RESTful Web Services (JAX-RS) is a Java programming language API that provides support in creating web services according to the REST architecture. JAX-RS uses annotations, introduced in Java SE 5, to simplify the development and deployment of web service clients and endpoints.
Support for JAX-RS 2.0 in WebLogic Server 12.1.3 is provided through the integration of the Jersey 2.5.1 library. The Jersey 2.5.1 library provides the Reference Implementation (RI) of JSR-399 (JAX-RS 2.0: Java API for RESTful Web Services) and is delivered as a shared library. So the first step is to register the Jersey 2.5.1 shared library.
Registering the Jersey 2.5.1 (JAX-RS 2.0 RI) Shared Library With Your WebLogic Server Instances
Using the administrative console, we can register the library by following these steps:
- Log into the WebLogic Server Administration : http://host:port/console
- Select Deployments.
- Click Install to install the shared library.
- In the Path field, enter or navigate to the following directory: MW_HOME\wlserver\common\deployable-libraries.
- Select the jax-rs-2.0.war file.
- Click Next.
- Select Install this deployment as a library.
- Click Next.
- Click Finish.
Create a sample Web Application
For creating the web application I prefer to use Eclipse for Java EE. I created a new Dynamic Web Project. For the demo purpose, I am going to create a simple web application and not an Enterprise web application, which is recommended by Oracle.
Create a package
Created an Example class and scripted a simple Hello world Application.(Note the folder structure to the right of the image)
Export as a WAR file
Deploy the application on the weblogic server
Access the rest url via a browser to test. http://<host>:<port>/<contextPath>/resources/helloworld