After you develop the Java class
files for your Java API for
RESTful Web Services (JAX-RS) Web application and edit the web.xml file
to enable the JAX-RS servlet, you must assemble the application.
Before you begin
Identify the assembly tool to use to assemble your application.
The Web application is assembled into a Web archive (WAR) package.
You can assemble the WAR package into an enterprise archive (EAR)
package if required.
Before assembling the Web application,
you must edit the web.xml file to enable the
JAX-RS servlet.
About this task
You must add the JAX-RS libraries to the Web application
in the WEB-INF/lib directory before you assemble
the Web application.
Procedure
- Locate the JAX-RS implementation in the application server
installation.
The default location of the JAX-RS installation
is the app_server_root/web2mobilefep_1.1/optionalLibraries/jaxrs_1.X directory.
- Add the following libraries to the WEB-INF/lib directory
of the Web application:
- jsr311-api.jar
- commons-lang.jar
- slf4j-api.jar
- slf4j-jdk14.jar
- ibm-wink-jaxrs.jar
If you are using a WebSphere Application Server Version
6.1 installation that does not have JAXB libraries installed, you
must include the following JAXB JAR file:
Avoid trouble: If you are migrating a JAX-RS
application from WebSphere Application Server Version 6.1 to a WebSphere
Application Server Version 7.0 install or you are migrating to a version
of the application server with a feature pack installed that includes
JAXB libraries, you must not include the JAXB JAR file.
gotcha
- If Java 2 Security is enabled, you must package your WAR
file into an EAR file, and add a was.policy file
to your application. Add the was.policy file
to your application with the following permissions:
grant codeBase "file:${application}" {
permission java.io.FilePermission "META-INF/wink-default.properties", "read";
permission java.io.FilePermission "META-INF/wink-alternate-shortcuts.properties", "read";
permission java.io.FilePermission "META-INF/core/wink-providers", "read";
permission java.io.FilePermission "META-INF/server/wink-providers", "read";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
};
- Create the WAR package using assembly tools.
Results
A WAR package is created that contains the Web application.
If needed, you can add the WAR package to an EAR package. The application
server can deploy either the WAR or EAR packages.
What to do next
Deploy the Web application.