| java.lang.Object de.webman.template.jsp.WebManServletContext
WebManServletContext | public class WebManServletContext implements ServletContext(Code) | | Defines a set of methods that a servlet uses to communicate
with a servlet engine, for example, to get the MIME type of a file,
locate other servlets running on the server, or
write to a servlet log file.
The servlet engine talks to the servlet by returning
a ServletContext object (defined by this interface)
that gives servlets information about their environment. Servlets use the
ServletConfig.getServletContext method to get
the ServletContext object.
If the server supports
multiple or virtual hosts, the ServletContext object
must be at least as unique as the host. Servlet engines can also
create ServletContext objects
that are unique to a group of servlets
and are tied to a specific part of the host's URL namespace.
You can assign this grouping administratively or define it in
a deployment descriptor file.
The ServletContext object is contained within
the
ServletConfig object, which the
Web server provides the
servlet when the servlet is initialized. You can access
the ServletConfig object by using the
Servlet.getServletConfig method.
author: Various version: $Version$ See Also: Servlet.getServletConfig See Also: ServletConfig.getServletContext |
getAttribute | public Object getAttribute(String name)(Code) | | Returns the servlet engine attribute with the given name,
or null
if there is none. An attribute allows a servlet engine to give the
servlet additional information not
already provided by this interface. See your
Web server documentation for information about its attributes.
The attribute is returned as a java.lang.Object .
Attribute names should follow the same convention as package
names. The Java Servlet API specification reserves names
matching java.* , javax.* ,
and sun.* .
Parameters: name - a String specifying the name of the attribute an Object nullif no attribute exists matching the givenname |
getContext | public ServletContext getContext(String uripath)(Code) | | Returns a 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.
Parameters: uripath - a String specifying the URL for which you are requesting a ServletContext object the ServletContext object thatcorresponds to the named URL See Also: RequestDispatcher |
getMajorVersion | public int getMajorVersion()(Code) | | Returns the major version of the Java Servlet API that this
Web server supports. All implementations that comply
with Version 2.1 must have this method
return the integer 2.
2 |
getMimeType | public String getMimeType(String file)(Code) | | Returns the MIME type of the specified file, or null if
the MIME type is not known. The MIME type is determined
by the configuration of the servlet engine. Common MIME
types are "text/html" and "image/gif" .
Parameters: a - String specifying the nameof the file whose MIME type you wantto check a String specifying the MIME type |
getMinorVersion | public int getMinorVersion()(Code) | | Returns the minor version of the Servlet API that this
Web server supports. All implementations that comply
with Version 2.1 must have this method
return the integer 1.
1 |
getRealPath | public String getRealPath(String path)(Code) | | Returns a String containing the real path
that corresponds to a virtual path. A virtual path contains
a servlet name followed by the name of a file the servlet
should act upon, in the form
/dir/dir/servlet/file.ext .
In this form, file.ext is a filename used instead
of the path to the file. The servlet locates the file and
translates the file name to the path that locates the file.
The real path the servlet returns is in a form
appropriate to the computer and operating system on
which the servlet engine is running, including the
proper path separators. This method returns null
if the servlet engine cannot translate the virtual path
to a real path for any reason.
Parameters: path - a String specifying a virtual path,in the form /dir/dir/servlet/file.ext a String specifying the real path,with path separators appropriate for the systemon which the servlet engine is running |
getRequestDispatcher | public RequestDispatcher getRequestDispatcher(String urlpath)(Code) | | Returns a
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.
Parameters: urlpath - a String specifying the pathnameto the resource a RequestDispatcher objectthat acts as a wrapper for the resourceat the path you specify See Also: RequestDispatcher |
getResource | public URL getResource(String path) throws MalformedURLException(Code) | | Returns the resource that is mapped to a specified
path. The path must be in the form
/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.
Parameters: path - a String specifyingthe path to the resource,in the form /dir/dir/file.ext the resource located at the named path,or null if there is no resourceat that path exception: MalformedURLException - if the pathname is not given in the correct form |
getResourceAsStream | public InputStream getResourceAsStream(String path)(Code) | | Returns the resource located at the named path as
an 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.
Parameters: name - a String specifying the pathto the resource,in the form /dir/dir/file.ext the InputStream returned to the servlet, or null if no resourceexists at the specified path |
getResourcePaths | public java.util.Set getResourcePaths(java.lang.String path)(Code) | | 2.3
Returns a directory-like listing of all the paths to resources within the web application
whose longest sub-path matches the supplied path argument.
Paths indicating subdirectory paths end with a '/'.
The returned paths are all relative to the root of the web application and have a leading '/'.
|
getServerInfo | public String getServerInfo()(Code) | | Returns the name and version of the servlet engine on which
the servlet is running.
The form of the returned string is servername/versionnumber.
For example, the Java Web Server can return the string
Java Web Server/1.1.3 .
You can design the servlet engine to have this method return
other optional information in parentheses after the primary string,
for example,
Java Web Server/1.1.3 (JDK 1.1.6; Windows NT 4.0 x86) .
a String containing at least the servlet engine name and version number |
getServletContextName | public java.lang.String getServletContextName()(Code) | | 2.3
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.
|
log | public void log(String msg)(Code) | | Writes the specified message to a servlet log file, which is usually
an event log. The message provides explanatory information about
an exception or error or an action the servlet engine takes. The name
and type of the servlet log file is specific to the servlet engine.
Parameters: msg - a String specifying the explanatorymessage to be written to the log file |
log | public void log(String message, Throwable throwable)(Code) | | Writes the stack trace and an explanatory message
for a given 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.
Parameters: message - a String that describes the error or exception Parameters: throwable - the Throwable error or exception |
removeAttribute | public void removeAttribute(String name)(Code) | | Removes the attribute with the given name from
the servlet context. If you remove an attribute, and
then use
WebManServletContext.getAttribute to retrieve the
attribute's value, getAttribute returns null .
Parameters: name - a String specifying the name of the attribute to be removed |
setAttribute | public void setAttribute(String name, Object object)(Code) | | Gives an attribute a name in this servlet context. If
the name specified is already used for an attribute, this
method will overwrite the old attribute and bind the name
to the new attribute.
Attribute names should follow the same convention as package
names. The Java Servlet API specification reserves names
matching java.* , javax.* , and
sun.* .
Parameters: name - a String specifying the name of the attribute Parameters: object - an Object representing theattribute to be given the name |
|
|