cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Where to put the ServerRuntime in a servlet app?
Date Wed, 22 Feb 2012 07:05:55 GMT
Yes, normally a Cayenne stack should be shared between all servlets, filters, etc. in a webapp.
"Application" scope is provided by javax.servlet.ServletContext per servlet specification.

Bootstrapping ServerRuntime and placing it in the app scope can be done via a variety of ways
- Filter.init, Servlet.init, ServletContextListener.contextInitialized. CayenneFilter provided
by Cayenne is a good template for how ServerRuntime should be started and stopped:


On Feb 22, 2012, at 1:12 AM, John Huss wrote:
> I'm new to Servlets and containers and all that.  If I have multiple
> servlets, where is the best place to create and store a reference to the
> cayenne ServerRuntime (I'm using 3.1)?  One of my servlets is an
> ROPHessianServlet and it gets the ServerRuntime information from the
> web.xml file.  But the others are just regular servlets.  I want to avoid
> creating a bunch of different runtimes and just have one.
> Thanks,
> John

View raw message