Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Is it possible to override the "directory.path" variable without recompiling the class. Add a <code>web.xml</code> file to your <code>WEB-INF</code> folder, that defines a a new init parameter.</p> <p>Change the <code>servlet-class</code> to the actual servlet class you are using.</p> <p>A restart of the container is necessary in order to take the changes into consideration, but no recompiling / rebuilding is needed.</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt; &lt;servlet&gt; &lt;servlet-name&gt;MyServletLinkName&lt;/servlet-name&gt; &lt;servlet-class&gt;your.path.to.servlet.YourServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;directory.path&lt;/param-name&gt; &lt;param-value&gt;/new/path&lt;/param-value&gt; &lt;/init-param&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;MyServletLinkName&lt;/servlet-name&gt; &lt;url-pattern&gt;/GetInfo&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p><strong>EDIT:</strong></p> <p>If you want to use a dynamic parameter that changes while the application runs, you could use a properties file that it is watched by a thread and inspected in a interval of X seconds.</p> <p>You may use a context param containing the location of the file together with a context initialized listener. The listener creates a watcher thread that updates some public variable that it is accessible by all your servlets.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload