Title: Remote Object Persistence CWS Deployment
Hessian-based Cayenne Web Service is a regular Java web application that contains Cayenne mapping file and persistent objects. What makes it a web service is a HessianServlet mapped via web.xml that handles requests from Cayenne Client Tier applications.
Client tier Java classes have to be present on the server together with server DataObjects. So you'll end up with two sets of objects mapped to the same set of entities. Hopefully we will get rid of this inconvenience in the future releases. |
myapp/ WEB-INF/ web.xml lib/ cayenne.jar hessian.jar my-db-driver.jar someother.jar classes/ cayenne.xml DataMap.map.xml DataNode.driver.xml com/mycompany/PersistentObject1.class com/mycompany/auto/_PersistentObject1.class com/mycompany/client/PersistentObject1.class com/mycompany/client/auto/_PersistentObject1.class
Cayenne service configuration is done via web.xml:
<session-config> <session-timeout>10</session-timeout> </session-config>
<servlet> <servlet-name>cayenne</servlet-name> <servlet-class>org.objectstyle.cayenne.remote.hessian.service.HessianServlet</servlet-class> <!-- optional - XMPPBridge setup for peer-to-peer notifications --> <!-- <init-param> <param-name>cayenne.RemoteService.EventBridge.factory</param-name> <param-value>org.objectstyle.cayenne.event.XMPPBridgeFactory</param-value> </init-param> <init-param> <param-name>cayenne.XMPPBridge.xmppHost</param-name> <param-value>localhost</param-value> </init-param> <init-param> <param-name>cayenne.XMPPBridge.xmppPort</param-name> <param-value>5222</param-value> </init-param> <init-param> <param-name>cayenne.XMPPBridge.xmppChatService</param-name> <param-value>conference</param-value> </init-param> --> </servlet> <servlet-mapping> <servlet-name>cayenne</servlet-name> <url-pattern>/cayenne</url-pattern> </servlet-mapping>
<security-constraint> <web-resource-collection> <web-resource-name>Cayenne Web Service</web-resource-name> <url-pattern>/cayenne</url-pattern> </web-resource-collection> <auth-constraint> <role-name>remote-app</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>CWS Realm</realm-name> </login-config> <security-role> <description>All CWS client applications</description> <role-name>remote-app</role-name> </security-role>