|
Enhydra 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.servlet.servletManager.EnhydraServletContext
Constructor Summary | |
protected |
EnhydraServletContext(java.lang.String name,
org.apache.log4j.Logger logger,
ServletManager servletManager,
java.util.Properties initArgs,
java.lang.String docRoot,
MultiClassLoader classLoader)
|
Method Summary | |
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration containing the
attribute names available
within this servlet context. |
MultiClassLoader |
getClassLoader()
Return the class loader used to load the servlet. |
javax.servlet.ServletContext |
getContext(java.lang.String uripath)
Returns a ServletContext object that
corresponds to a specified URL on the server. |
java.lang.String |
getInitParameter(java.lang.String name)
Return the value for the given context parameter name. |
java.util.Enumeration |
getInitParameterNames()
Return an Enumeration of all of the context parameter names. |
org.apache.log4j.Logger |
getLogger()
Return the LogChannel for the servlet. |
int |
getMajorVersion()
Returns the major version of the Java Servlet API that this Web server supports. |
java.lang.String |
getMimeType(java.lang.String file)
|
int |
getMinorVersion()
Returns the minor version of the Servlet API that this Web server supports. |
java.lang.String |
getName()
Returns the name of this servlet. |
javax.servlet.RequestDispatcher |
getNamedDispatcher(java.lang.String name)
Returns a dispatcher for the given resource name. |
java.lang.String |
getRealPath(java.lang.String path)
Transate a partial path to the real location on disk. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String urlpath)
Returns a RequestDispatcher object that acts
as a wrapper for the resource located at the named path. |
java.net.URL |
getResource(java.lang.String path)
Returns the resource that is mapped to a specified path. |
java.io.InputStream |
getResourceAsStream(java.lang.String path)
Returns the resource located at the named path as an InputStream object. |
java.lang.String |
getServerInfo()
|
javax.servlet.Servlet |
getServlet(java.lang.String name)
|
java.util.Enumeration |
getServletNames()
Returns an enumeration of the Servlet object names in this server. |
java.util.Enumeration |
getServlets()
|
void |
log(java.lang.Exception except,
java.lang.String msg)
|
void |
log(java.lang.String msg)
|
void |
log(java.lang.String message,
java.lang.Throwable throwable)
Writes the stack trace and an explanatory message for a given Throwable exception
to the servlet log file. |
void |
removeAttribute(java.lang.String name)
Removes the attribute with the given name from the servlet context. |
void |
setAttribute(java.lang.String name,
java.lang.Object object)
Gives an attribute a name in this servlet context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected EnhydraServletContext(java.lang.String name, org.apache.log4j.Logger logger, ServletManager servletManager, java.util.Properties initArgs, java.lang.String docRoot, MultiClassLoader classLoader)
Method Detail |
public javax.servlet.Servlet getServlet(java.lang.String name) throws javax.servlet.ServletException
getServlet
in interface javax.servlet.ServletContext
javax.servlet.ServletException
public java.util.Enumeration getServlets()
getServlets
in interface javax.servlet.ServletContext
public void log(java.lang.String msg)
log
in interface javax.servlet.ServletContext
public void log(java.lang.Exception except, java.lang.String msg)
log
in interface javax.servlet.ServletContext
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletContext
path
- The filname (probably the tail end of a URL) to translate.
public java.lang.String getMimeType(java.lang.String file)
getMimeType
in interface javax.servlet.ServletContext
public java.lang.String getServerInfo()
getServerInfo
in interface javax.servlet.ServletContext
public int getMajorVersion()
getMajorVersion
in interface javax.servlet.ServletContext
public int getMinorVersion()
getMinorVersion
in interface javax.servlet.ServletContext
public javax.servlet.ServletContext getContext(java.lang.String uripath)
ServletContext
object that
corresponds to a specified URL on the server.
This method allows servlets to gain
access to the resources located at a specified URL and obtain
RequestDispatcher
objects from it.
In security conscious environments, the servlet engine can
return null
for a given URL.
getContext
in interface javax.servlet.ServletContext
uripath
- a String
specifying the URL for
which you are requesting a ServletContext
object
ServletContext
object that
corresponds to the named URLRequestDispatcher
public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException
/dir/dir/file.ext
.
This method allows the Web server to make a resource available to a servlet from any source. Resources can be located on a local or remote file system, in a database, or on a remote network site.
This method can return null
if no resource is mapped to the pathname.
The servlet engine must implement the URL handlers
and URLConnection
objects that are necessary
to access the resource.
This method has a different purpose than
java.lang.Class.getResource
,
which looks up resources based on a class loader. This
method does not use class loaders.
getResource
in interface javax.servlet.ServletContext
path
- a String
specifying
the path to the resource,
in the form /dir/dir/file.ext
null
if there is no resource
at that path
java.net.MalformedURLException
- if the pathname is not given in
the correct formpublic java.io.InputStream getResourceAsStream(java.lang.String path)
InputStream
object.
The data in the InputStream
can be
of any type or length. The path must be of
the form /dir/dir/file.ext
. This method
returns null
if no resource exists at
the specified path.
Metainformation such as content length and content type
that is available when you use the getResource
method is lost when you use this method.
The servlet engine 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 engines
to make a resource available
to a servlet from any location, without using a class loader.
getResourceAsStream
in interface javax.servlet.ServletContext
InputStream
returned to the
servlet, or null
if no resource
exists at the specified pathpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String urlpath)
RequestDispatcher
object that acts
as a wrapper for the resource located at the named path.
You can use a RequestDispatcher
object to forward
a request to the resource or include a resource in a response.
The pathname must be in the form /dir/dir/file.ext
.
This method returns null
if the ServletContext
cannot return a RequestDispatcher
.
The servlet engine is responsible for wrapping the resource
with a RequestDispatcher
object.
getRequestDispatcher
in interface javax.servlet.ServletContext
urlpath
- a String
specifying the pathname
to the resource
RequestDispatcher
object
that acts as a wrapper for the resource
at the path you specifyRequestDispatcher
public void log(java.lang.String message, java.lang.Throwable throwable)
Throwable
exception
to the servlet log file. The stack trace is
part of the Throwable
object, and
the message is the one you specify in the message
parameter. The name and type of the servlet log file is specific to
the servlet engine, but it is usually an event log.
log
in interface javax.servlet.ServletContext
message
- a String
that
describes the error or exceptionthrowable
- the Throwable
error
or exceptionpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletContext
public java.util.Enumeration getAttributeNames()
Enumeration
containing the
attribute names available
within this servlet context. You can use the
getAttribute(java.lang.String)
method with an attribute name
to get the value of an attribute.
getAttributeNames
in interface javax.servlet.ServletContext
Enumeration
of attribute
namesgetAttribute(java.lang.String)
public void setAttribute(java.lang.String name, java.lang.Object object)
Attribute names should follow the same convention as package
names. The Java Servlet API specification reserves names
matching java.*
, javax.*
, and
sun.*
.
setAttribute
in interface javax.servlet.ServletContext
name
- a String
specifying the name
of the attributeobject
- an Object
representing the
attribute to be given the namepublic void removeAttribute(java.lang.String name)
getAttribute(java.lang.String)
to retrieve the
attribute's value, getAttribute
returns null
.
removeAttribute
in interface javax.servlet.ServletContext
name
- a String
specifying the name
of the attribute to be removedpublic javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String name)
getNamedDispatcher
in interface javax.servlet.ServletContext
name
- A String resource name to use to find a RequestDispatcher.
public java.lang.String getInitParameter(java.lang.String name)
getInitParameter
in interface javax.servlet.ServletContext
name
- A String context parameter name.
public java.util.Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletContext
public java.lang.String getName()
public org.apache.log4j.Logger getLogger()
LogChannel
for the servlet. The servlet my
write directly to this channel, or use the log()
method, which will write to the log channel at the INFO
level.
public MultiClassLoader getClassLoader()
public java.util.Enumeration getServletNames()
getServletNames
in interface javax.servlet.ServletContext
|
Enhydra 5.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |