JspRuntimeContext (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.jasper.compiler, class: JspRuntimeContext

# Class JspRuntimeContext

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

public final class JspRuntimeContext extends Object
Class for tracking JSP compile time file dependencies when the >%@include file="..."%< 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.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JspRuntimeContext(ServletContext context, Options options)`
  Create a JspRuntimeContext for a web application context.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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 JSPs.
  `void`
  `checkUnload()`
  Method used by background thread to check if any JSPs should be unloaded.
  `void`
  `destroy()`
  Process a "destroy" event for this web application context.
  `String`
  `getClassPath()`
  Returns 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.
  `int`
  `getJspQueueLength()`
  Gets the number of JSPs that are in the JSP limiter queue
  `int`
  `getJspReloadCount()`
  Gets the current value of the JSP reload counter.
  `int`
  `getJspUnloadCount()`
  Gets the number of JSPs that have been unloaded.
  `long`
  `getLastJspQueueUpdate()`
  Returns the last time the update background task has run.
  `Options`
  `getOptions()`
  Returns the options for this runtime context.
  `ClassLoader`
  `getParentClassLoader()`
  Get the parent ClassLoader.
  `PermissionCollection`
  `getPermissionCollection()`
  Get the SecurityManager PermissionCollection for this web application context.
  `Map<String, SmapStratum>`
  `getSmaps()`
  Returns the map of SMAP strata for compiled JSPs.
  `JspServletWrapper`
  `getWrapper(String jspUri)`
  Get an already existing JspServletWrapper.
  `void`
  `incrementJspReloadCount()`
  Increments the JSP reload counter.
  `boolean`
  `isCompileCheckInProgress()`
  Returns whether a compile check is currently in progress.
  `void`
  `makeYoungest(FastRemovalDequeue<JspServletWrapper>.Entry unloadHandle)`
  Push unloadHandle for JspServletWrapper to front of the queue.
  `FastRemovalDequeue<JspServletWrapper>.Entry`
  `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.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### 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
      `options` - The main Jasper options

- ## Method Details

  - ### 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 FastRemovalDequeue<JspServletWrapper>.Entry push(JspServletWrapper jsw)
    Push a newly compiled JspServletWrapper into the queue at first execution of jsp. Destroy any JSP that has been replaced in the queue.
    Parameters:
      `jsw` - Servlet wrapper for jsp.
    Returns:
      an unloadHandle that can be pushed to front of queue at later execution times.

  - ### makeYoungest

    public void makeYoungest(FastRemovalDequeue<JspServletWrapper>.Entry unloadHandle)
    Push unloadHandle for JspServletWrapper to front of the queue.
    Parameters:
      `unloadHandle` - the unloadHandle 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

  - ### getJspQueueLength

    public int getJspQueueLength()
    Gets the number of JSPs that are in the JSP limiter queue
    Returns:
      The number of JSPs (in the webapp with which this JspServlet is associated) that are in the JSP limiter queue

  - ### getJspUnloadCount

    public int getJspUnloadCount()
    Gets the number of JSPs that have been unloaded.
    Returns:
      The number of JSPs (in the webapp with which this JspServlet is associated) that have been unloaded

  - ### checkCompile

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

  - ### isCompileCheckInProgress

    public boolean isCompileCheckInProgress()
    Returns whether a compile check is currently in progress.
    Returns:
      `true` if a compile check is in progress

  - ### getClassPath

    public String getClassPath()
    Returns the classpath that is passed off to the Java compiler.
    Returns:
      the compilation classpath

  - ### getLastJspQueueUpdate

    public long getLastJspQueueUpdate()
    Returns the last time the update background task has run.
    Returns:
      last time the update background task has run

  - ### getSmaps

    public Map<String, SmapStratum> getSmaps()
    Returns the map of SMAP strata for compiled JSPs.
    Returns:
      the map of SMAP strata

  - ### getOptions

    public Options getOptions()
    Returns the options for this runtime context.
    Returns:
      the options

  - ### checkUnload

    public void checkUnload()
    Method used by background thread to check if any JSPs should be unloaded.