Harri,
On 4/13/22 07:32, Harri Pesonen wrote:
Hello, is it possible to change the context file in
$CATALINA_HOME/conf/Catalina/localhost/app.xml
so that application would get the new configuration without restarting?
Without restarting... what exactly? And what would you want to change?
Usually the things in that deployment descriptor are pretty fundamental
to how the application starts-up, etc.
I could not find such thing in servlet specification.
The servlet spec doesn't have anything like this in there, but Tomcat
does. Sort of, depending upon exactly what you are trying to accomplish.
Or would it be possible to manually read the file from the application, for
example once a minute?
Now the application gets the configuration from init():
javax.servlet.GenericServlet.java
/**
* Called by the servlet container to indicate to a servlet that the
* servlet is being placed into service. See {@link Servlet#init}.
*
* <p>This implementation stores the {@link ServletConfig}
* object it receives from the servlet container for later use.
* When overriding this form of the method, call
* <code>super.init(config)</code>.
*
* @param config
the <code>ServletConfig</code> object
*
that contains
configutation
*
information for
this servlet
*
* @exception ServletException if an exception occurs
that
*
interrupts the
servlet's normal
*
operation
*
* @see
UnavailableException
*/
public void init(ServletConfig config) throws ServletException {
this.config = config;
this.init();
}
I suppose that getServletConfig() returns the same cached data without
re-reading it from disk?
/**
* Returns this servlet's {@link ServletConfig} object.
*
* @return ServletConfig the <code>ServletConfig</code> object
*
that initialized this servlet
*/
public ServletConfig getServletConfig() {
return config;
}
Can you be more specific about what you want to achieve? I have some
ideas, but before I send you down a potentially confusing path, it would
be good to understand your goals.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org