public final class JspRuntimeContext extends Object implements Runnable
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.
Constructor and Description |
---|
JspRuntimeContext(javax.servlet.ServletContext context,
Options options)
Create a JspRuntimeContext for a web application context.
|
Modifier and Type | Method and Description |
---|---|
void |
addWrapper(String jspUri,
JspServletWrapper jsw)
Add a new JspServletWrapper.
|
void |
adjustBytecodeTime(String name,
long reference) |
void |
destroy()
Process a "destory" event for this web application context.
|
byte[] |
getBytecode(String name)
Retrieve the bytecode associated with the class
|
long |
getBytecodeBirthTime(String name)
Retrieve the time the bytecode for a class was created
|
Map<String,byte[]> |
getBytecodes()
Get the class-name to bytecode map
|
String |
getClassPath()
The classpath that is passed off to the Java compiler.
|
CodeSource |
getCodeSource()
Get the SecurityManager Policy CodeSource for this web applicaiton
context.
|
int |
getJspCount()
Returns the number of JSPs for which JspServletWrappers exist, i.e., the
number of JSPs that have been loaded into the webapp.
|
int |
getJspReloadCount()
Gets the current value of the JSP reload counter.
|
Map<String,ArrayList<Object>> |
getPackageMap()
The packageMap keeps track of the bytecode files in a package generated
by a java compiler.
|
ClassLoader |
getParentClassLoader()
Get the parent URLClassLoader.
|
PermissionCollection |
getPermissionCollection()
Get the SecurityManager PermissionCollection for this web application
context.
|
JspServletWrapper |
getWrapper(String jspUri)
Get an already existing JspServletWrapper.
|
void |
incrementJspReloadCount()
Increments the JSP reload counter.
|
void |
removeWrapper(String jspUri)
Remove a JspServletWrapper.
|
void |
run()
The background thread that checks for changes to files included by a JSP
and flags that a recompile is required.
|
void |
saveBytecode(String className,
String classFileName)
Save the bytecode for a class to disk.
|
void |
setBytecode(String name,
byte[] bytecode)
Save the bytecode for the class in a map.
|
void |
setJspReloadCount(int count)
Resets the JSP reload counter.
|
protected void |
threadSleep()
Sleep for the duration specified by the
checkInterval
property. |
protected void |
threadStart()
Start the background thread that will periodically check for changes to
compile time included files in a JSP.
|
protected void |
threadStop()
Stop the background thread that is periodically checking for changes to
compile time included files in a JSP.
|
public JspRuntimeContext(javax.servlet.ServletContext context, Options options)
Loads in any previously generated dependencies from file.
context
- ServletContext for web applicationpublic void addWrapper(String jspUri, JspServletWrapper jsw)
jspUri
- JSP URIjsw
- Servlet wrapper for JSPpublic JspServletWrapper getWrapper(String jspUri)
jspUri
- JSP URIpublic void removeWrapper(String jspUri)
jspUri
- JSP URI of JspServletWrapper to removepublic int getJspCount()
public CodeSource getCodeSource()
public ClassLoader getParentClassLoader()
public PermissionCollection getPermissionCollection()
public void destroy()
public void incrementJspReloadCount()
public int getJspReloadCount()
public void setJspReloadCount(int count)
count
- Value to which to reset the JSP reload counterpublic void setBytecode(String name, byte[] bytecode)
name
- The name of the classbytecode
- The bytecode in byte arraypublic void adjustBytecodeTime(String name, long reference)
public byte[] getBytecode(String name)
public long getBytecodeBirthTime(String name)
public Map<String,ArrayList<Object>> getPackageMap()
public void saveBytecode(String className, String classFileName)
public String getClassPath()
protected void threadStart()
IllegalStateException
- if we should not be starting a background thread nowprotected void threadStop()
protected void threadSleep()
checkInterval
property.Copyright © 2006–2018 TinyGroup. All rights reserved.