Forums Register Login

Loading common web objects on startup

+Pie Number of slices to send: Send
I have a bunch of common application-wide static data objects in my web application. I want to load them at startup so I don't waste time getting them from the data store each time I need them. The only way I know how to do this is with filters. In the filter check to see if the objects are loaded, if not load them as servlet context attributes.

I keep thinking there must be a way to put a class in the application context on startup so that the filter does not have to check on each request.

Any ideas?
+Pie Number of slices to send: Send
Explore the concept of the context listener.
+Pie Number of slices to send: Send
Another (older & inferior) strategy is to define a servlet that loads on startup and initializes system-wide objects.
The moustache of a titan! The ad of a flea:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 609 times.
Similar Threads
bundle, in one config file, web parameter names?
javaranch - Mock exam
How to deal with configuration data in a (web) application?
Storing images and css in a database
Loading Servlet On Startup
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:46:50.