Class for tracking JSP compile time file dependencies when the
&060;%@include file="..."%&062; directive is used.
A background thread periodically checks the files a JSP page
is dependent upon. If a dpendent file changes the JSP page
which included it is recompiled.
Only used if a web application context is a directory.
| Method from org.apache.jasper.compiler.JspRuntimeContext Detail: |
public void addWrapper(String jspUri,
JspServletWrapper jsw) {
// ------------------------------------------------------ Public Methods
jsps.put(jspUri, jsw);
}
Add a new JspServletWrapper. |
public void checkCompile() {
if (lastCheck < 0) {
// Checking was disabled
return;
}
long now = System.currentTimeMillis();
if (now > (lastCheck + (options.getCheckInterval() * 1000L))) {
lastCheck = now;
} else {
return;
}
Object [] wrappers = jsps.values().toArray();
for (int i = 0; i < wrappers.length; i++ ) {
JspServletWrapper jsw = (JspServletWrapper)wrappers[i];
JspCompilationContext ctxt = jsw.getJspEngineContext();
// JspServletWrapper also synchronizes on this when
// it detects it has to do a reload
synchronized(jsw) {
try {
ctxt.compile();
} catch (FileNotFoundException ex) {
ctxt.incrementRemoved();
} catch (Throwable t) {
jsw.getServletContext().log("Background compile failed",
t);
}
}
}
}
Method used by background thread to check the JSP dependencies
registered with this class for JSP's. |
public void destroy() {
Iterator servlets = jsps.values().iterator();
while (servlets.hasNext()) {
((JspServletWrapper) servlets.next()).destroy();
}
}
Process a "destory" event for this web application context. |
public String getClassPath() {
return classpath;
}
The classpath that is passed off to the Java compiler. |
public CodeSource getCodeSource() {
return codeSource;
}
Get the SecurityManager Policy CodeSource for this web
applicaiton context. |
public int getJspCount() {
return jsps.size();
}
Returns the number of JSPs for which JspServletWrappers exist, i.e.,
the number of JSPs that have been loaded into the webapp. |
public int getJspReloadCount() {
return jspReloadCount;
}
Gets the current value of the JSP reload counter. |
public URLClassLoader getParentClassLoader() {
return parentClassLoader;
}
Get the parent URLClassLoader. |
public PermissionCollection getPermissionCollection() {
return permissionCollection;
}
Get the SecurityManager PermissionCollection for this
web application context. |
public JspServletWrapper getWrapper(String jspUri) {
return jsps.get(jspUri);
}
Get an already existing JspServletWrapper. |
public synchronized void incrementJspReloadCount() {
jspReloadCount++;
}
Increments the JSP reload counter. |
public void removeWrapper(String jspUri) {
jsps.remove(jspUri);
}
Remove a JspServletWrapper. |
public synchronized void setJspReloadCount(int count) {
this.jspReloadCount = count;
}
Resets the JSP reload counter. |