|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.mortbay.jetty.servlet.Context
Jetty Servlet Context.
| Field Summary | |
static int |
__distantFuture
|
static java.lang.String |
__SessionId
|
static java.lang.String |
__SessionUrlPrefix
|
| Method Summary | |
static void |
access(HttpSession session)
|
java.lang.Object |
getAttribute(java.lang.String name)
Get context attribute. |
java.util.Enumeration |
getAttributeNames()
Get context attribute names. |
ServletContext |
getContext(java.lang.String uri)
Returns a ServletContext object that
corresponds to a specified URL on the server. |
java.lang.String |
getContextPath()
|
java.util.Enumeration |
getIds()
Deprecated. From HttpSessionContext |
java.lang.String |
getInitParameter(java.lang.String param)
Get context init parameter. |
java.util.Enumeration |
getInitParameterNames()
Get context init parameter names. |
int |
getMajorVersion()
Returns the major version of the Java Servlet API that this servlet container supports. |
java.lang.String |
getMimeType(java.lang.String file)
Returns the MIME type of the specified file, or null if
the MIME type is not known. |
int |
getMinorVersion()
Returns the minor version of the Servlet API that this servlet container supports. |
RequestDispatcher |
getNamedDispatcher(java.lang.String name)
Returns a RequestDispatcher object that acts
as a wrapper for the named servlet. |
java.lang.String |
getRealPath(java.lang.String path)
Returns a String containing the real path
for a given virtual path. |
RequestDispatcher |
getRequestDispatcher(java.lang.String uriInContext)
Returns a RequestDispatcher object that acts
as a wrapper for the resource located at the given path. |
java.net.URL |
getResource(java.lang.String uriInContext)
Get a Resource. |
java.io.InputStream |
getResourceAsStream(java.lang.String uriInContext)
Returns the resource located at the named path as an InputStream object. |
java.lang.String |
getServerInfo()
Returns the name and version of the servlet container on which the servlet is running. |
Servlet |
getServlet(java.lang.String name)
Deprecated. |
java.util.Enumeration |
getServletNames()
Deprecated. |
java.util.Enumeration |
getServlets()
Deprecated. |
HttpSession |
getSession(java.lang.String id)
Deprecated. From HttpSessionContext |
static boolean |
isValid(HttpSession session)
|
void |
log(java.lang.Exception e,
java.lang.String msg)
|
void |
log(java.lang.String msg)
Servlet Log. |
void |
log(java.lang.String msg,
java.lang.Throwable th)
Writes an explanatory message and a stack trace for a given Throwable exception
to the servlet log file. |
HttpSession |
newSession()
|
void |
removeAttribute(java.lang.String name)
Remove context attribute. |
int |
sessionCount()
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set context attribute names. |
void |
setSessionTimeout(int timeoutMinutes)
Set the default session timeout. |
void |
stop()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String __SessionId
public static final java.lang.String __SessionUrlPrefix
public static final int __distantFuture
| Method Detail |
public java.lang.String getContextPath()
public ServletContext getContext(java.lang.String uri)
ServletContextServletContext object that
corresponds to a specified URL on the server.
This method allows servlets to gain
access to the context for various parts of the server, and as
needed obtain RequestDispatcher objects from the context.
The given path must be absolute (beginning with "/") and is
interpreted based on the server's document root.
In a security conscious environment, the servlet container may
return null for a given URL.
getContext in interface ServletContextjavax.servlet.ServletContexturipath - a String specifying the absolute URL of
a resource on the serverServletContext object that
corresponds to the named URLRequestDispatcherpublic int getMajorVersion()
ServletContextgetMajorVersion in interface ServletContextjavax.servlet.ServletContextpublic int getMinorVersion()
ServletContextgetMinorVersion in interface ServletContextjavax.servlet.ServletContextpublic java.lang.String getMimeType(java.lang.String file)
ServletContextnull if
the MIME type is not known. The MIME type is determined
by the configuration of the servlet container, and may be specified
in a web application deployment descriptor. Common MIME
types are "text/html" and "image/gif".getMimeType in interface ServletContextjavax.servlet.ServletContextfile - a String specifying the name
of a fileString specifying the file's MIME type
public java.net.URL getResource(java.lang.String uriInContext)
throws java.net.MalformedURLException
getResource in interface ServletContexturiInContext - java.net.MalformedURLException - public java.io.InputStream getResourceAsStream(java.lang.String uriInContext)
ServletContextInputStream object.
The data in the InputStream can be
of any type or length. The path must be specified according
to the rules given in getResource.
This method returns null if no resource exists at
the specified path.
Meta-information such as content length and content type
that is available via getResource
method is lost when using this method.
The servlet container must implement the URL handlers
and URLConnection objects necessary to access
the resource.
This method is different from
java.lang.Class.getResourceAsStream,
which uses a class loader. This method allows servlet containers
to make a resource available
to a servlet from any location, without using a class loader.
getResourceAsStream in interface ServletContextjavax.servlet.ServletContextname - a String specifying the path
to the resourceInputStream returned to the
servlet, or null if no resource
exists at the specified pathpublic RequestDispatcher getRequestDispatcher(java.lang.String uriInContext)
ServletContextRequestDispatcher object that acts
as a wrapper for the resource located at the given path.
A RequestDispatcher object can be used to forward
a request to the resource or to include the resource in a response.
The resource can be dynamic or static.
The pathname must begin with a "/" and is interpreted as relative
to the current context root. Use getContext to obtain
a RequestDispatcher for resources in foreign contexts.
This method returns null if the ServletContext
cannot return a RequestDispatcher.
getRequestDispatcher in interface ServletContextjavax.servlet.ServletContextpath - a String specifying the pathname
to the resourceRequestDispatcher object
that acts as a wrapper for the resource
at the specified pathRequestDispatcher,
ServletContext.getContext(java.lang.String)public RequestDispatcher getNamedDispatcher(java.lang.String name)
ServletContextRequestDispatcher 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 ServletContextjavax.servlet.ServletContextname - 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 Servlet getServlet(java.lang.String name)
getServlet in interface ServletContextpublic java.util.Enumeration getServlets()
getServlets in interface ServletContextpublic java.util.Enumeration getServletNames()
getServletNames in interface ServletContextpublic void log(java.lang.String msg)
log in interface ServletContextmsg -
public void log(java.lang.Exception e,
java.lang.String msg)
log in interface ServletContext
public void log(java.lang.String msg,
java.lang.Throwable th)
ServletContextThrowable exception
to the servlet log file. The name and type of the servlet log
file is specific to the servlet container, usually an event log.log in interface ServletContextjavax.servlet.ServletContextmessage - a String that
describes the error or exceptionthrowable - the Throwable error
or exceptionpublic java.lang.String getRealPath(java.lang.String path)
ServletContextString containing the real path
for a given virtual path. For example, the virtual path "/index.html"
has a real path of whatever file on the server's filesystem would be
served by a request for "/index.html".
The real path returned will be in a form
appropriate to the computer and operating system on
which the servlet container is running, including the
proper path separators. This method returns null
if the servlet container cannot translate the virtual path
to a real path for any reason (such as when the content is
being made available from a .war archive).
getRealPath in interface ServletContextjavax.servlet.ServletContextpath - a String specifying a virtual pathString specifying the real path,
or null if the translation cannot be performedpublic java.lang.String getServerInfo()
ServletContextThe form of the returned string is
servername/versionnumber.
For example, the JavaServer Web Development Kit may return the string
JavaServer Web Dev Kit/1.0.
The servlet container may return other optional information
after the primary string in parentheses, for example,
JavaServer Web Dev Kit/1.0 (JDK 1.1.6; Windows NT 4.0 x86).
getServerInfo in interface ServletContextjavax.servlet.ServletContextString containing at least the
servlet container name and version numberpublic java.lang.String getInitParameter(java.lang.String param)
getInitParameter in interface ServletContextparam - param namepublic java.util.Enumeration getInitParameterNames()
getInitParameterNames in interface ServletContextpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface ServletContextname - attribute name.public java.util.Enumeration getAttributeNames()
getAttributeNames in interface ServletContextjavax.servlet.ServletContextEnumeration of attribute
namesServletContext.getAttribute(java.lang.String)
public void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface ServletContextname - attribute name.value - attribute valuepublic void removeAttribute(java.lang.String name)
removeAttribute in interface ServletContextname - attribute name.public java.util.Enumeration getIds()
getIds in interface HttpSessionContextpublic HttpSession getSession(java.lang.String id)
getSession in interface HttpSessionContextpublic int sessionCount()
public HttpSession newSession()
public static void access(HttpSession session)
public static boolean isValid(HttpSession session)
public void setSessionTimeout(int timeoutMinutes)
default - The timeout in minutespublic void stop()
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 | ||||||||