public final class JspRuntimeContext
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Long> |
bytecodeBirthTimes |
private java.util.Map<java.lang.String,byte[]> |
bytecodes
Maps class names to in-memory bytecodes
|
private java.lang.String |
classpath |
private java.security.CodeSource |
codeSource |
private javax.servlet.ServletContext |
context
This web applications ServletContext
|
private java.util.concurrent.atomic.AtomicInteger |
jspReloadCount |
private java.util.Map<java.lang.String,JspServletWrapper> |
jsps
Maps JSP pages to their JspServletWrapper's
|
private static java.util.logging.Logger |
log |
private Options |
options |
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.tools.JavaFileObject>> |
packageMap
Maps classes in packages compiled by the JSP compiler.
|
private java.security.PermissionCollection |
permissionCollection |
private java.lang.Thread |
thread
The background thread.
|
private boolean |
threadDone
The background thread completion semaphore.
|
private java.lang.String |
threadName
Name to register for the background thread.
|
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(java.lang.String jspUri,
JspServletWrapper jsw)
Add a new JspServletWrapper.
|
void |
adjustBytecodeTime(java.lang.String name,
long reference) |
private void |
checkCompile()
Method used by background thread to check the JSP dependencies
registered with this class for JSP's.
|
void |
destroy()
Process a "destory" event for this web application context.
|
byte[] |
getBytecode(java.lang.String name)
Retrieve the bytecode associated with the class
|
long |
getBytecodeBirthTime(java.lang.String name)
Retrieve the time the bytecode for a class was created
|
java.util.Map<java.lang.String,byte[]> |
getBytecodes()
Get the class-name to bytecode map
|
java.lang.String |
getClassPath()
The classpath that is passed off to the Java compiler.
|
java.security.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.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.tools.JavaFileObject>> |
getPackageMap()
The packageMap keeps track of the bytecode files in a package generated
by a java compiler.
|
java.lang.ClassLoader |
getParentClassLoader()
Get the parent class loader.
|
java.security.PermissionCollection |
getPermissionCollection()
Get the SecurityManager PermissionCollection for this
web application context.
|
JspServletWrapper |
getWrapper(java.lang.String jspUri)
Get an already existing JspServletWrapper.
|
void |
incrementJspReloadCount()
Increments the JSP reload counter.
|
private void |
initClassPath()
Method used to initialize classpath for compiles.
|
private void |
initSecurity()
Method used to initialize SecurityManager data.
|
void |
removeWrapper(java.lang.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(java.lang.String className,
java.lang.String classFileName)
Save the bytecode for a class to disk.
|
void |
setBytecode(java.lang.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.
|
private static java.util.logging.Logger log
private java.util.concurrent.atomic.AtomicInteger jspReloadCount
private javax.servlet.ServletContext context
private Options options
private java.security.PermissionCollection permissionCollection
private java.security.CodeSource codeSource
private java.lang.String classpath
private java.util.Map<java.lang.String,JspServletWrapper> jsps
private java.util.Map<java.lang.String,byte[]> bytecodes
private java.util.Map<java.lang.String,java.lang.Long> bytecodeBirthTimes
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.tools.JavaFileObject>> packageMap
private java.lang.Thread thread
private boolean threadDone
private java.lang.String threadName
public JspRuntimeContext(javax.servlet.ServletContext context, Options options)
context
- ServletContext for web applicationpublic void addWrapper(java.lang.String jspUri, JspServletWrapper jsw)
jspUri
- JSP URIjsw
- Servlet wrapper for JSPpublic JspServletWrapper getWrapper(java.lang.String jspUri)
jspUri
- JSP URIpublic void removeWrapper(java.lang.String jspUri)
jspUri
- JSP URI of JspServletWrapper to removepublic int getJspCount()
public java.security.CodeSource getCodeSource()
public java.lang.ClassLoader getParentClassLoader()
public java.security.PermissionCollection getPermissionCollection()
public void destroy()
public void incrementJspReloadCount()
public void setJspReloadCount(int count)
count
- Value to which to reset the JSP reload counterpublic int getJspReloadCount()
public void setBytecode(java.lang.String name, byte[] bytecode)
name
- The name of the classbytecode
- The bytecode in byte arraypublic void adjustBytecodeTime(java.lang.String name, long reference)
public java.util.Map<java.lang.String,byte[]> getBytecodes()
public byte[] getBytecode(java.lang.String name)
public long getBytecodeBirthTime(java.lang.String name)
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.tools.JavaFileObject>> getPackageMap()
public void saveBytecode(java.lang.String className, java.lang.String classFileName)
private void checkCompile()
public java.lang.String getClassPath()
private void initClassPath()
private void initSecurity()
protected void threadStart()
java.lang.IllegalStateException
- if we should not be starting
a background thread nowprotected void threadStop()
protected void threadSleep()
checkInterval
property.public void run()
run
in interface java.lang.Runnable