Apache Tomcat 7.0.4

org.apache.jasper.compiler
Class JspRuntimeContext

java.lang.Object
  extended by org.apache.jasper.compiler.JspRuntimeContext

public final class JspRuntimeContext
extends Object

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 dependent file changes the JSP page which included it is recompiled. Only used if a web application context is a directory.

Version:
$Revision: 1001933 $
Author:
Glenn L. Nielsen

Constructor Summary
JspRuntimeContext(ServletContext context, Options options)
          Create a JspRuntimeContext for a web application context.
 
Method Summary
 void addWrapper(String jspUri, JspServletWrapper jsw)
          Add a new JspServletWrapper.
 void checkCompile()
          Method used by background thread to check the JSP dependencies registered with this class for JSP's.
 void checkUnload()
          Method used by background thread to check if any JSP's should be destroyed.
 void destroy()
          Process a "destroy" event for this web application context.
 String getClassPath()
          The classpath that is passed off to the Java compiler.
 CodeSource getCodeSource()
          Get the SecurityManager Policy CodeSource for this web application 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.
 JspServletWrapper getJspForUnload(int maxLoadedJsps)
          Returns a JspServletWrapper that should be destroyed.
 int getJspReloadCount()
          Gets the current value of the JSP reload counter.
 ClassLoader getParentClassLoader()
          Get the parent ClassLoader.
 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 makeFirst(Entry<JspServletWrapper> ticket)
          Push ticket for JspServletWrapper to front of the queue.
 Entry<JspServletWrapper> push(JspServletWrapper jsw)
          Push a newly compiled JspServletWrapper into the queue at first execution of jsp.
 void removeWrapper(String jspUri)
          Remove a JspServletWrapper.
 void setJspReloadCount(int count)
          Resets the JSP reload counter.
 boolean unloadJsp()
          Checks whether there is a jsp to unload, if one is found, it is destroyed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspRuntimeContext

public JspRuntimeContext(ServletContext context,
                         Options options)
Create a JspRuntimeContext for a web application context. Loads in any previously generated dependencies from file.

Parameters:
context - ServletContext for web application
Method Detail

addWrapper

public void addWrapper(String jspUri,
                       JspServletWrapper jsw)
Add a new JspServletWrapper.

Parameters:
jspUri - JSP URI
jsw - Servlet wrapper for JSP

getWrapper

public JspServletWrapper getWrapper(String jspUri)
Get an already existing JspServletWrapper.

Parameters:
jspUri - JSP URI
Returns:
JspServletWrapper for JSP

removeWrapper

public void removeWrapper(String jspUri)
Remove a JspServletWrapper.

Parameters:
jspUri - JSP URI of JspServletWrapper to remove

push

public Entry<JspServletWrapper> push(JspServletWrapper jsw)
Push a newly compiled JspServletWrapper into the queue at first execution of jsp.

Parameters:
jsw - Servlet wrapper for jsp.
Returns:
a ticket that can be pushed to front of queue at later execution times.

makeFirst

public void makeFirst(Entry<JspServletWrapper> ticket)
Push ticket for JspServletWrapper to front of the queue.

Parameters:
ticket - the ticket for the jsp.

getJspCount

public int getJspCount()
Returns the number of JSPs for which JspServletWrappers exist, i.e., the number of JSPs that have been loaded into the webapp.

Returns:
The number of JSPs that have been loaded into the webapp

getCodeSource

public CodeSource getCodeSource()
Get the SecurityManager Policy CodeSource for this web application context.

Returns:
CodeSource for JSP

getParentClassLoader

public ClassLoader getParentClassLoader()
Get the parent ClassLoader.

Returns:
ClassLoader parent

getPermissionCollection

public PermissionCollection getPermissionCollection()
Get the SecurityManager PermissionCollection for this web application context.

Returns:
PermissionCollection permissions

destroy

public void destroy()
Process a "destroy" event for this web application context.


incrementJspReloadCount

public void incrementJspReloadCount()
Increments the JSP reload counter.


setJspReloadCount

public void setJspReloadCount(int count)
Resets the JSP reload counter.

Parameters:
count - Value to which to reset the JSP reload counter

getJspReloadCount

public int getJspReloadCount()
Gets the current value of the JSP reload counter.

Returns:
The current value of the JSP reload counter

checkCompile

public void checkCompile()
Method used by background thread to check the JSP dependencies registered with this class for JSP's.


getClassPath

public String getClassPath()
The classpath that is passed off to the Java compiler.


getJspForUnload

public JspServletWrapper getJspForUnload(int maxLoadedJsps)
Returns a JspServletWrapper that should be destroyed. Default strategy: Least recently used.


checkUnload

public void checkUnload()
Method used by background thread to check if any JSP's should be destroyed. If JSP's to be unloaded are found, they will be destroyed. Uses the lastCheck time from background compiler to determine if it is time to unload JSP's.


unloadJsp

public boolean unloadJsp()
Checks whether there is a jsp to unload, if one is found, it is destroyed.


Apache Tomcat 7.0.4

Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.