I wrote a servlet to trigger off a reload of the struts-config.xml.
The servlet is:
protected void doGet(..) {
ActionServlet as =
((ActionServlet)request.getSession().getServletContext().getAttribute(Global
s.ACTION_SERVLET_KEY));
as.destroy();
request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
CESSOR_KEY);
as.init();
new PrintStream(response.getOutputStream()).println("Reload ok.");
}
Now my questions...
1) Is there another way to trigger off a reload without using the Tomcat's
reload
function (which takes a very long time and leaves db connections open?)
2) I had to call removeAttribute(Globals.REQUEST_PROCESSOR_KEY) because the
destroy method
of the ActionServlet doesn't do it. Here is the code (from
ActionServlet.destroyModules()):
[..]
if (value instanceof ModuleConfig) {
ModuleConfig config = (ModuleConfig) value;
getRequestProcessor(config).destroy();
getServletContext().removeAttribute(name);
I think there should be something like
getServletContext().removeAttribute(Globals.REQUEST_PROCESSOR_KEY +
config.getPrefix());
If I don't remove the attribute following requests will not work (because of
the code
in ActionServlet.getRequestProcessor)
Is this a bug?
3) Don't you think that something like that could be useful? I mean, if
answer to 1) is NO,
wouldn't be useful to have a configuration reloader with struts?
4) Calling actionServlet.destroy() and actionServlet.init() is enough to
re-load the whole
struts-config.xml?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]