public class ServletWebContext extends java.lang.Object implements WebContext
ServletContext as WebContext.| Constructor and Description |
|---|
ServletWebContext(javax.servlet.ServletContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
describeTo(DescriptionReceiver receiver)
Invoked to have the receiver describe itself (largely in terms of properties and values).
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the named object, or null if no attribute has been stored with the given name.
|
java.util.List |
getAttributeNames()
Returns a list of all known attributes in ascending alphabetical order.
|
java.util.List |
getInitParameterNames()
Returns a sorted list of the names of all initialization parameters (which may be the empty
list).
|
java.lang.String |
getInitParameterValue(java.lang.String name)
Returns the value of the named parameter, or null if the reciever does not have such a
parameter.
|
java.lang.String |
getMimeType(java.lang.String resourcePath)
Returns the MIME type of the specified file, or null if the MIME type is not known.
|
java.lang.String |
getRealPath(java.lang.String path)
Returns a
String containing the real path for a given virtual path. |
java.net.URL |
getResource(java.lang.String path)
Returns a URL to 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.util.Set |
getResourcePaths(java.lang.String path)
Returns a directory-like listing of all the paths to resources within
the web application whose longest sub-path matches the supplied
path argument.
|
void |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Updates the attribute, replacing (or removing) its value.
|
public ServletWebContext(javax.servlet.ServletContext context)
public void describeTo(DescriptionReceiver receiver)
DescribabletoString().describeTo in interface Describablepublic java.util.List getAttributeNames()
AttributeHoldergetAttributeNames in interface AttributeHolderpublic java.lang.Object getAttribute(java.lang.String name)
AttributeHoldergetAttribute in interface AttributeHolderpublic void setAttribute(java.lang.String name, java.lang.Object attribute)
AttributeHolderWebSession
attribute in a clustered application).setAttribute in interface AttributeHoldername - the name of the attribute to updateattribute - the new value for the attribute, or null to delete the attribute entirely.public java.net.URL getResource(java.lang.String path)
WebContextgetResource in interface WebContextpublic java.lang.String getInitParameterValue(java.lang.String name)
InitializationParameterHoldergetInitParameterValue in interface InitializationParameterHoldername - the name of the parameter to retrievepublic java.util.List getInitParameterNames()
InitializationParameterHoldergetInitParameterNames in interface InitializationParameterHolderpublic java.lang.String getMimeType(java.lang.String resourcePath)
WebContextgetMimeType in interface WebContextpublic java.lang.String getRealPath(java.lang.String path)
WebContextString containing the real path for a given virtual path.
For example, the path "/index.html" returns the absolute file path
on the server's filesystem would be served by a request for
"http://host/contextPath/index.html", where contextPath is the
context path of this WebContext.getRealPath in interface WebContextpath - a String specifying a virtual pathString specifying the real path, or null if the
translation cannot be performedpublic java.io.InputStream getResourceAsStream(java.lang.String path)
WebContextInputStream
object.getResourceAsStream in interface WebContextpath - 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 path)
WebContextgetResourcePaths in interface WebContextpath - partial path used to match the resources, which must start with a '/'