Now lets get back to the "cayenne-tutorial" project that contains a web application.
- Add hessian.jar to the list of project libraries by right clicking the "cayenne-tutorial" project, selecting "Java Build Path > Libraries" and clicking "Add External Jar" button on the right. As a reminder, Hessian jar can be downloaded from here if you haven't done this already.
- Cayenne web service is specified declaratively in web.xml. It is simply a servlet - org.objectstyle.cayenne.remote.hessian.service.HessianServlet. No extra code is needed on the server. Open cayenne-tutorial/webapp/WEB-INF/web.xml in Eclipse and add the servlet section.
- Since our web application serves JSP files as well, you also need to remap Cayenne Filter setup earlier, so that it only applies to JSPs. The resulting complete web.xml will look like this:
- Now you can run the web application (that contains a web service) with JettyLauncher, as described before.
- Web application URLs (e.g. http://localhost:8080/) should continue to work as before, but let's try the service URL: http://localhost:8080/cayenne-service. You will see "Hessian Requires POST" error message in the browser, that means that the service is alive, but you need a client other than the web browser to access it.
Now you can shutdown the web application in Eclipse.
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.