com.caucho.jsp
Class Page

java.lang.Object
  extended by com.caucho.jsp.Page
All Implemented Interfaces:
CauchoPage, Servlet, ServletConfig
Direct Known Subclasses:
JavaPage, StaticPage

public abstract class Page
extends java.lang.Object
implements Servlet, ServletConfig, CauchoPage

Represents a compiled JSP page.


Field Summary
protected static java.util.logging.Logger _caucho_log
           
protected  java.lang.String _contentType
           
 
Constructor Summary
Page()
           
 
Method Summary
protected  void _caucho_addCacheDepend(Path path, long lastModified, long length)
          Adds a single cache dependency.
protected  void _caucho_addDepend(java.util.ArrayList<PersistentDependency> dependList)
          Adds an array of dependencies to the page.
protected  void _caucho_addDepend(Path path)
          Adds a dependency to the page.
protected  void _caucho_addDepend(Path path, long lastModified, long length)
          Adds a JSP source dependency.
protected  void _caucho_addDepend(PersistentDependency depend)
          Adds a dependency to the page.
 void _caucho_free()
          Marks the page as free.
 WebApp _caucho_getApplication()
          Returns the Resin webApp.
 java.util.ArrayList<Dependency> _caucho_getDependList()
           
protected  java.util.HashMap<java.lang.String,java.lang.reflect.Method> _caucho_getFunctionMap()
          Returns true if the underlying source has been modified.
 void _caucho_init(HttpServletRequest req, HttpServletResponse res)
          Initialize the response headers.
 boolean _caucho_isModified()
          Returns true if the underlying source has been modified.
 long _caucho_lastModified()
          The default Last-Modified time is just the most recently modified file.
protected  void _caucho_setAlwaysModified()
          When called treats the JSP page as always modified, i.e.
protected  void _caucho_setCacheable()
          Marks the page as cacheable.
protected  void _caucho_setContentType(java.lang.String contentType, java.lang.String encoding)
           
protected  void _caucho_setModified()
          When called treats the JSP page as always modified, i.e.
protected  void _caucho_setNeverModified(boolean modified)
          Set if the page is never modified.
 void _caucho_use()
          Marks the page as used.
static long calculateLastModified(java.util.ArrayList<PersistentDependency> depends, java.util.ArrayList<Depend> cacheDepends)
          Calculate the last modified time for all the dependencies.
 void caucho_init(ServletConfig config)
           
 void destroy()
          Called when the servlet shuts down.
 java.lang.String getInitParameter(java.lang.String name)
          Returns an initialization parameter.
 java.util.Enumeration<java.lang.String> getInitParameterNames()
          Returns an enumeration of the init-parameter names
 long getLastModified(HttpServletRequest request)
          Returns the Last-Modified time for use in caching.
 ServletConfig getServletConfig()
          Returns this servlet's configuration.
 ServletContext getServletContext()
          Returns the ServletContext for the servlet or filter.
 java.lang.String getServletInfo()
          Returns an information string about the servlet.
 java.lang.String getServletName()
          Returns the servlet name for this configuration.
 void init(Path path)
           
 void init(ServletConfig config)
          Initialize the servlet.
 boolean isDead()
           
 boolean isInit()
          Returns true if initializes.
 void log(java.lang.String msg)
           
 void log(java.lang.String msg, java.lang.Throwable cause)
           
 void pageservice(HttpServletRequest req, HttpServletResponse res)
          The extended service method creates JavaScript global variables from a property map.
protected  void setDead()
           
 boolean startRecompiling()
          Starts recompiling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Servlet
service
 

Field Detail

_caucho_log

protected static final java.util.logging.Logger _caucho_log

_contentType

protected java.lang.String _contentType
Constructor Detail

Page

public Page()
Method Detail

init

public void init(Path path)
          throws ServletException
Specified by:
init in interface CauchoPage
Throws:
ServletException

caucho_init

public void caucho_init(ServletConfig config)
                 throws ServletException
Specified by:
caucho_init in interface CauchoPage
Throws:
ServletException

_caucho_setContentType

protected void _caucho_setContentType(java.lang.String contentType,
                                      java.lang.String encoding)

_caucho_setAlwaysModified

protected void _caucho_setAlwaysModified()
When called treats the JSP page as always modified, i.e. always forcing recompilation.


_caucho_setModified

protected void _caucho_setModified()
When called treats the JSP page as always modified, i.e. always forcing recompilation.


_caucho_setNeverModified

protected void _caucho_setNeverModified(boolean modified)
Set if the page is never modified. Some users want to deploy the JSP classes without the JSP source.


_caucho_addDepend

protected void _caucho_addDepend(Path path)
Adds a dependency to the page.

Parameters:
path - the file the JSP page is dependent on.

_caucho_addDepend

protected void _caucho_addDepend(PersistentDependency depend)
Adds a dependency to the page.

Parameters:
path - the file the JSP page is dependent on.

_caucho_addDepend

protected void _caucho_addDepend(java.util.ArrayList<PersistentDependency> dependList)
Adds an array of dependencies to the page.


_caucho_addDepend

protected void _caucho_addDepend(Path path,
                                 long lastModified,
                                 long length)
Adds a JSP source dependency. If the source file changes, the JSP must be recompiled.

Parameters:
path - the path to the file
lastModified - the last modified time
length - the length of the file

_caucho_getDependList

public java.util.ArrayList<Dependency> _caucho_getDependList()
Specified by:
_caucho_getDependList in interface CauchoPage

_caucho_setCacheable

protected void _caucho_setCacheable()
Marks the page as cacheable.


_caucho_addCacheDepend

protected void _caucho_addCacheDepend(Path path,
                                      long lastModified,
                                      long length)
Adds a single cache dependency. A cache dependency will cause the page to be rerun, but will not force a recompilation of the JSP.

Parameters:
path - the path to the file
lastModified - the last modified time
length - the length of the file

_caucho_isModified

public boolean _caucho_isModified()
Returns true if the underlying source has been modified.

Specified by:
_caucho_isModified in interface CauchoPage

_caucho_getFunctionMap

protected java.util.HashMap<java.lang.String,java.lang.reflect.Method> _caucho_getFunctionMap()
Returns true if the underlying source has been modified.


init

public void init(ServletConfig config)
          throws ServletException
Initialize the servlet.

Specified by:
init in interface Servlet
Parameters:
config - information from the configuration file.
Throws:
ServletException

isInit

public boolean isInit()
Returns true if initializes.


_caucho_getApplication

public WebApp _caucho_getApplication()
Returns the Resin webApp.

Specified by:
_caucho_getApplication in interface CauchoPage

getServletContext

public ServletContext getServletContext()
Description copied from interface: ServletConfig
Returns the ServletContext for the servlet or filter.

Specified by:
getServletContext in interface ServletConfig

getServletName

public java.lang.String getServletName()
Description copied from interface: ServletConfig
Returns the servlet name for this configuration. For example, 'myservlet' in the following configuration:

 <servlet servlet-name='myservlet'
          servlet-class='test.MyServlet'/>
 

Specified by:
getServletName in interface ServletConfig

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)
Description copied from interface: ServletConfig
Returns an initialization parameter. Initialization parameters are defined in the servlet configuration (in resin.conf) as follows:

 <servlet servlet-name='myservlet'
          servlet-class='test.MyServlet'>
   <init-param param1='value1'/>
   <init-param param2='value2'/>
 </servlet>
 

Specified by:
getInitParameter in interface ServletConfig
Parameters:
name - of the parameter
Returns:
the init parameter value

getInitParameterNames

public java.util.Enumeration<java.lang.String> getInitParameterNames()
Description copied from interface: ServletConfig
Returns an enumeration of the init-parameter names

Specified by:
getInitParameterNames in interface ServletConfig

log

public void log(java.lang.String msg)

log

public void log(java.lang.String msg,
                java.lang.Throwable cause)

getServletInfo

public java.lang.String getServletInfo()
Description copied from interface: Servlet
Returns an information string about the servlet.

Specified by:
getServletInfo in interface Servlet

getServletConfig

public ServletConfig getServletConfig()
Returns this servlet's configuration.

Specified by:
getServletConfig in interface Servlet

_caucho_init

public void _caucho_init(HttpServletRequest req,
                         HttpServletResponse res)
Initialize the response headers.


getLastModified

public long getLastModified(HttpServletRequest request)
Returns the Last-Modified time for use in caching. If the result is <= 0, last-modified caching is disabled.

Returns:
the last modified time.

_caucho_lastModified

public long _caucho_lastModified()
The default Last-Modified time is just the most recently modified file. For JSP files, this is overwritten to always return 0.

Specified by:
_caucho_lastModified in interface CauchoPage

calculateLastModified

public static long calculateLastModified(java.util.ArrayList<PersistentDependency> depends,
                                         java.util.ArrayList<Depend> cacheDepends)
Calculate the last modified time for all the dependencies. The last modified time is the time of the most recently changed cache or source file.

Parameters:
depends - list of the source file dependencies
cacheDepends - list of the cache dependencies
Returns:
the last modified time in milliseconds

pageservice

public void pageservice(HttpServletRequest req,
                        HttpServletResponse res)
                 throws java.io.IOException,
                        ServletException
The extended service method creates JavaScript global variables from a property map.

This method only makes sense for JavaScript templates. To pass variables to Java templates, use the setAttribute() method of the request.

Parameters:
properties - hashmap of objects to create as JavaScript globals.
Throws:
java.io.IOException
ServletException

setDead

protected void setDead()

isDead

public boolean isDead()

startRecompiling

public boolean startRecompiling()
Starts recompiling. Returns false if the recompiling has already started or if the page has already been destroyed.


_caucho_use

public void _caucho_use()
Marks the page as used.


_caucho_free

public void _caucho_free()
Marks the page as free.


destroy

public void destroy()
Description copied from interface: Servlet
Called when the servlet shuts down. Servlets can use this to close database connections, etc. Servlets generally only shutdown when the application closes.

Specified by:
destroy in interface Servlet