Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The application is packaged in a WAR file (which is similar to a JAR/ZIP file, except with special files in certain locations and a defined layout). It can be deployed in any web container, for example: Jetty, Tomcat and Geronimo. Perform the following steps in order to create the "helloworld" example application.

...

Step 3

Creating a web.xml file

Next, Now create a web.xml deployment descriptor. The deployment descriptor details information about the web application in the WAR. In this case, it says that the Apache Wink JAX-RS servlet should be initialized with a HelloWorldApplication instance.

...

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
    <display-name>Hello world Web Application</display-name>
    <servlet>
        <servlet-name>HelloWorldApp</servlet-name>
        <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>org.apache.wink.example.helloworld.HelloWorldApplication</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>HelloWorldApp</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
</web-app>

Step 4

Packaging the web application into a WAR file

Layout the application as follows and create a WAR file from the base directory (the one before WEB-INF). Create a WAR by running "*jar cvf helloworld-jaxrs.war **" from the base directory.

...

Code Block
WEB-INF/classes/org/apache/wink/example/helloworld/HelloWorldApplication.class
WEB-INF/classes/org/apache/wink/example/helloworld/HelloWorldResource.class
WEB-INF/lib/activation-1.1.jar
WEB-INF/lib/commons-lang-2.3.jar
WEB-INF/lib/jaxb-api-2.1.jar
WEB-INF/lib/jaxb-impl-2.1.4.jar
WEB-INF/lib/json-20080701.jar
WEB-INF/lib/jsr311-api-1.0.jar
WEB-INF/lib/slf4j-api-1.5.8.jar
WEB-INF/lib/slf4j-simple-1.5.8.jar
WEB-INF/lib/stax-api-1.0-2.jar
WEB-INF/lib/wink-common-<version #>.jar
WEB-INF/lib/wink-server-<version #>.jar
WEB-INF/lib/xercesImpl-2.6.2.jar
WEB-INF/web.xml

Step 5

Installing the WAR file into your environment

...