|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.server.http.Application
The state for a servlet application. Manages sessions, servlets, class loaders and configuration.
Method Summary | |
void |
addDepend(Path path)
Add a dependency |
void |
addListener(ExitListener listener)
Adds a listener to be notified when the Application closes. |
void |
clearCache()
Clears the cache. |
static ServletException |
error(RegistryNode node,
java.lang.String msg)
Throws a configuration error for a given configuration line number. |
static ServletException |
error(RegistryNode node,
java.lang.Throwable e)
Throws a configuration error for a given configuration line number. |
Path |
getAppDir()
Returns the application's root directory. |
java.lang.String |
getAppDirName()
Returns the user's string for the application root directory. |
Path |
getAppInf()
Returns the APP-INF directory. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the servlet container attribute with the given name, or null if there is no attribute by that name. |
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration containing the
attribute names available
within this servlet context. |
ServletAuthenticator |
getAuthenticator()
Returns the application's authenticator. |
java.lang.String |
getChain(java.lang.String mimeType)
Returns the chained servlet name by the mime-type. |
DynamicClassLoader |
getClassLoader()
Returns the class loader for the application. |
ServletContext |
getContext(java.lang.String name)
Returns the named servlet context. |
java.lang.String |
getContextPath()
|
java.util.ArrayList |
getDepends()
Return all the dependencies |
java.lang.String |
getHost()
Returns the application's virtual host name. |
java.lang.String |
getInitParameter(java.lang.String name)
Returns a String containing the value of the named
context-wide initialization parameter, or null if the
parameter does not exist. |
java.util.Enumeration |
getInitParameterNames()
Returns the names of the context's initialization parameters as an Enumeration of String objects, or an
empty Enumeration if the context has no initialization
parameters. |
javax.naming.Context |
getJndiContext()
Returns the JNDI context for this application. |
RequestDispatcher |
getLoginDispatcher(java.lang.String uriPath)
Returns a request dispatcher for the given uripath. |
int |
getMajorVersion()
Returns the Servlet API major version |
java.lang.String |
getMimeType(java.lang.String path)
Returns the mime-type for a uri. |
int |
getMinorVersion()
Returns the Servlet API minor version |
RequestDispatcher |
getNamedDispatcher(java.lang.String name)
Returns a RequestDispatcher object that acts
as a wrapper for the named servlet. |
RegistryNode |
getOriginalRegistry()
|
java.util.HashMap |
getPathVariableMap()
|
long |
getRandomSeed()
Returns the server's random number generator. |
java.lang.String |
getRealPath(java.lang.String uri)
Returns the physical path for the uri, in native path. |
RegistryNode |
getRegistry()
|
RequestDispatcher |
getRequestDispatcher(java.lang.String uriPath)
Returns a request dispatcher for the given uripath. |
java.net.URL |
getResource(java.lang.String name)
Returns a resource for the given uri. |
java.io.InputStream |
getResourceAsStream(java.lang.String uripath)
Returns the resource for a uripath as an input stream. |
java.util.Set |
getResourcePaths(java.lang.String prefix)
Returns an enumeration of all the resources. |
ServletServer |
getServer()
Returns the servlet server. |
java.lang.String |
getServerInfo()
Returns the server identification string. |
Servlet |
getServlet(java.lang.String name)
Deprecated. |
java.lang.String |
getServletContextName()
Returns the name of this web application correponding to this ServletContext as specified in the deployment descriptor for this web application by the display-name element. |
java.util.Enumeration |
getServletNames()
Deprecated. |
java.util.Enumeration |
getServlets()
Deprecated. |
com.caucho.http.session.SessionManager |
getSessionManager()
Returns the application's SessionManager. |
java.lang.String |
getURL()
|
VirtualHost |
getVirtualHost()
Returns the application's virtual host. |
Path |
getWar()
Return the underlying war. |
Path |
getWorkDir()
Returns the application's jsp work directory. |
void |
log(java.lang.Exception e,
java.lang.String msg)
Deprecated. |
void |
log(java.lang.String message)
Logs a message to the error file. |
void |
log(java.lang.String message,
java.lang.Throwable e)
Error logging |
void |
log(java.lang.String message,
java.lang.Throwable e,
HttpServletRequest request,
HttpServletResponse response)
Error logging |
void |
removeAttribute(java.lang.String name)
Removes an attribute from the servlet context. |
void |
restart()
Restarts the application. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets an application attribute. |
void |
setWar(Path war)
Set the underlying war. |
java.lang.String |
toString()
|
static void |
verifyElements(RegistryNode node,
IntMap validElements)
Verify that all the child elements of the node are actually allowed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public java.util.HashMap getPathVariableMap()
public VirtualHost getVirtualHost()
public ServletServer getServer()
public java.lang.String getServerInfo()
getServerInfo
in interface ServletContext
javax.servlet.ServletContext
String
containing at least the
servlet container name and version numberpublic int getMajorVersion()
getMajorVersion
in interface ServletContext
javax.servlet.ServletContext
public int getMinorVersion()
getMinorVersion
in interface ServletContext
javax.servlet.ServletContext
public long getRandomSeed()
public ServletContext getContext(java.lang.String name)
getContext
in interface ServletContext
name
- absolute url naming the context.public com.caucho.http.session.SessionManager getSessionManager()
public java.lang.String getRealPath(java.lang.String uri)
getRealPath
in interface ServletContext
javax.servlet.ServletContext
path
- a String
specifying a virtual pathString
specifying the real path,
or null if the translation cannot be performedpublic java.lang.String getMimeType(java.lang.String path)
getMimeType
in interface ServletContext
javax.servlet.ServletContext
file
- a String
specifying the name
of a fileString
specifying the file's MIME typepublic ServletAuthenticator getAuthenticator()
getAuthenticator
in interface CauchoApplication
public java.net.URL getResource(java.lang.String name)
getResource
in interface ServletContext
javax.servlet.ServletContext
path
- a String
specifying
the path to the resourcenull
if there is no resource
at that pathjava.net.MalformedURLException
- if the pathname is not given in
the correct formpublic java.io.InputStream getResourceAsStream(java.lang.String uripath)
getResourceAsStream
in interface ServletContext
javax.servlet.ServletContext
name
- a String
specifying the path
to the resourceInputStream
returned to the
servlet, or null
if no resource
exists at the specified pathpublic java.util.Set getResourcePaths(java.lang.String prefix)
getResourcePaths
in interface ServletContext
javax.servlet.ServletContext
the
- partial path used to match the resources, which must start with a /public RequestDispatcher getRequestDispatcher(java.lang.String uriPath)
getRequestDispatcher
in interface ServletContext
uriPath
- absolute uri interpreted as relative to the app root.public RequestDispatcher getNamedDispatcher(java.lang.String name)
ServletContext
RequestDispatcher
object that acts
as a wrapper for the named servlet.
Servlets (and JSP pages also) may be given names via server
administration or via a web application deployment descriptor.
A servlet instance can determine its name using
ServletConfig.getServletName()
.
This method returns null
if the
ServletContext
cannot return a RequestDispatcher
for any reason.
getNamedDispatcher
in interface ServletContext
javax.servlet.ServletContext
name
- a String
specifying the name
of a servlet to wrapRequestDispatcher
object
that acts as a wrapper for the named servletRequestDispatcher
,
ServletContext.getContext(java.lang.String)
,
ServletConfig.getServletName()
public RequestDispatcher getLoginDispatcher(java.lang.String uriPath) throws ServletException
uriPath
- absolute uri interpreted as relative to the app root.public void restart()
public void log(java.lang.String message)
log
in interface ServletContext
msg
- the message to logpublic void log(java.lang.Exception e, java.lang.String msg)
log
in interface ServletContext
public void log(java.lang.String message, java.lang.Throwable e)
log
in interface CauchoApplication
message
- message to loge
- stack trace of the errorpublic void log(java.lang.String message, java.lang.Throwable e, HttpServletRequest request, HttpServletResponse response)
message
- message to loge
- stack trace of the errorpublic javax.naming.Context getJndiContext()
public java.lang.Object getAttribute(java.lang.String name)
ServletContext
null
if there is no attribute by that name.
An attribute allows a servlet container to give the
servlet additional information not
already provided by this interface. See your
server documentation for information about its attributes.
A list of supported attributes can be retrieved using
getAttributeNames
.
The attribute is returned as a java.lang.Object
or some subclass.
Attribute names should follow the same convention as package
names. The Java Servlet API specification reserves names
matching java.*
, javax.*
,
and sun.*
.
getAttribute
in interface ServletContext
javax.servlet.ServletContext
name
- a String
specifying the name
of the attributeObject
containing the value
of the attribute, or null
if no attribute exists matching the given
nameServletContext.getAttributeNames()
public java.util.Enumeration getAttributeNames()
ServletContext
Enumeration
containing the
attribute names available
within this servlet context. Use the
ServletContext.getAttribute(java.lang.String)
method with an attribute name
to get the value of an attribute.getAttributeNames
in interface ServletContext
javax.servlet.ServletContext
Enumeration
of attribute
namesServletContext.getAttribute(java.lang.String)
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface ServletContext
name
- the name of the attributevalue
- the value of the attributepublic void removeAttribute(java.lang.String name)
removeAttribute
in interface ServletContext
name
- the name of the attribute to remove.public Servlet getServlet(java.lang.String name)
getServlet
in interface ServletContext
public java.util.Enumeration getServlets()
getServlets
in interface ServletContext
public java.util.Enumeration getServletNames()
getServletNames
in interface ServletContext
public java.lang.String getServletContextName()
ServletContext
getServletContextName
in interface CauchoApplication
javax.servlet.ServletContext
public java.lang.String getInitParameter(java.lang.String name)
ServletContext
String
containing the value of the named
context-wide initialization parameter, or null
if the
parameter does not exist.
This method can make available configuration information useful to an entire "web application". For example, it can provide a webmaster's email address or the name of a system that holds critical data.
getInitParameter
in interface ServletContext
javax.servlet.ServletContext
name
- a String
containing the name of the
parameter whose value is requestedString
containing at least the
servlet container name and version numberServletConfig.getInitParameter(java.lang.String)
public java.util.Enumeration getInitParameterNames()
ServletContext
Enumeration
of String
objects, or an
empty Enumeration
if the context has no initialization
parameters.getInitParameterNames
in interface ServletContext
javax.servlet.ServletContext
Enumeration
of String
objects containing the names of the context's
initialization parametersServletConfig.getInitParameter(java.lang.String)
public java.lang.String getContextPath()
getContextPath
in interface CauchoApplication
public java.lang.String getURL()
public Path getAppDir()
getAppDir
in interface CauchoApplication
public java.lang.String getAppDirName()
public Path getAppInf()
public Path getWar()
public void setWar(Path war)
public void addDepend(Path path)
public java.util.ArrayList getDepends()
public RegistryNode getOriginalRegistry()
public RegistryNode getRegistry()
getRegistry
in interface CauchoApplication
public java.lang.String getHost()
getHost
in interface CauchoApplication
public java.lang.String getChain(java.lang.String mimeType)
getChain
in interface CauchoApplication
public DynamicClassLoader getClassLoader()
getClassLoader
in interface CauchoApplication
public void addListener(ExitListener listener)
addListener
in interface CauchoApplication
listener
- the object to notify on closepublic void clearCache()
clearCache
in interface CauchoApplication
public Path getWorkDir()
public static void verifyElements(RegistryNode node, IntMap validElements) throws ServletException
node
- the configuration nodevalidElements
- mapping of valid child elements.public static ServletException error(RegistryNode node, java.lang.String msg)
node
- the configuration node throwing the error.msg
- the error message.public static ServletException error(RegistryNode node, java.lang.Throwable e)
node
- the configuration node throwing the error.e
- exception thrown for that node.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |