Title: Remote Object Persistence Tutorial WebService

Deploying a Web Service

Now lets get back to the "cayenne-tutorial" project that contains a web application.

web.xml
...
<servlet>
    <servlet-name>cayenne-service</servlet-name>
    <servlet-class>org.apache.cayenne.remote.hessian.service.HessianServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>cayenne-service</servlet-name>
    <url-pattern>/cayenne-service</url-pattern>
</servlet-mapping>
web.xml
<?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>Cayenne Tutorial</display-name>
    <filter>
        <filter-name>CayenneFilter</filter-name>
        <filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CayenneFilter</filter-name>
        <url-pattern>/</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>CayenneFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    
    <servlet>
        <servlet-name>cayenne-service</servlet-name>
        <servlet-class>org.apache.cayenne.remote.hessian.service.HessianServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>cayenne-service</servlet-name>
        <url-pattern>/cayenne-service</url-pattern>
    </servlet-mapping>	
	
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

Now you can shutdown the web application in Eclipse.

Final Step...

As of version 1.2, both client and server persistent classes need to be present on the server (client of course only needs client classes). This is a minor inconvenience that will be addressed in the future releases. To satisfy this requirement, right click the "cayenne-tutorial" project, select "Java Build Path > Projects > Add..." and add cayenne-tutorial-client as a project dependency.


Next Step: Remote Object Persistence Tutorial Client Code