org.apache.sling.scripting.jsp.jasper.compiler
Class JspRuntimeContext

java.lang.Object
  extended by org.apache.sling.scripting.jsp.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 dpendent file changes the JSP page which included it is recompiled. Only used if a web application context is a directory.

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

Nested Class Summary
static class JspRuntimeContext.JspFactoryHandler
          This is a delegate forwarding either to our own factory or the original one.
 
Constructor Summary
JspRuntimeContext(javax.servlet.ServletContext context, Options options)
          Create a JspRuntimeContext for a web application context.
 
Method Summary
 void addJspDependencies(JspServletWrapper jsw)
           
 void addWrapper(String jspUri, JspServletWrapper jsw)
          Add a new JspServletWrapper.
 void destroy()
          Process a "destroy" event for this web application context.
 JspServletWrapper getAWrapper()
           
 String getClassPath()
          The classpath that is passed off to the Java compiler.
 CodeSource getCodeSource()
          Get the SecurityManager Policy CodeSource for this web applicaiton context.
 IOProvider getIOProvider()
          Returns the current IOProvider of this 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.
 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 handleModification(String scriptName)
           
 void incrementJspReloadCount()
          Increments the JSP reload counter.
static JspRuntimeContext.JspFactoryHandler initFactoryHandler()
          Preload classes required at runtime by a JSP servlet so that we don't get a defineClassInPackage security exception.
 void removeWrapper(String jspUri)
          Remove a JspServletWrapper.
 void setIOProvider(IOProvider ioProvider)
          Sets the IOProvider to use in this context.
 void setJspReloadCount(int count)
          Resets the JSP reload counter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspRuntimeContext

public JspRuntimeContext(javax.servlet.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

initFactoryHandler

public static JspRuntimeContext.JspFactoryHandler initFactoryHandler()
Preload classes required at runtime by a JSP servlet so that we don't get a defineClassInPackage security exception. And set jsp factory


addJspDependencies

public void addJspDependencies(JspServletWrapper jsw)

handleModification

public void handleModification(String scriptName)

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

getAWrapper

public JspServletWrapper getAWrapper()

removeWrapper

public void removeWrapper(String jspUri)
Remove a JspServletWrapper.

Parameters:
jspUri - JSP URI of JspServletWrapper to remove

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 applicaiton context.

Returns:
CodeSource for JSP

getParentClassLoader

public ClassLoader getParentClassLoader()
Get the parent URLClassLoader.

Returns:
URLClassLoader 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

getClassPath

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


getIOProvider

public IOProvider getIOProvider()
Returns the current IOProvider of this context.


setIOProvider

public void setIOProvider(IOProvider ioProvider)
Sets the IOProvider to use in this context.

Parameters:
ioProvider - The IOProvider to use in this context. If this is null the default provider is set.


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.