I wonder if anyone can advise on a Java webapp question?
I have a set standard Java class which has methods to set and get values of a property file. These methods a
The ServletContext
via a ServletContextListener
, as someone stated above, can be used to load static variables in a configuration class. It can also be triggered to reload those variables if needed. Also, you simply need access to the HttpServletRequest
object to get to the context. If you pass the request to an intermediary object you can get to the context easy enough.
ServletContext application = req.getSession().getServletContext();
Then you can access the data by putting it into a temp variable if needed which can then be passed to other functions and eventually release it's resources when it goes out of scope.