public interface WebContext extends AttributeHolder, InitializationParameterHolder, Describable
Modifier and Type | Method and Description |
---|---|
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.
|
getAttribute, getAttributeNames, setAttribute
getInitParameterNames, getInitParameterValue
describeTo
java.net.URL getResource(java.lang.String path)
java.lang.String getMimeType(java.lang.String resourcePath)
java.util.Set getResourcePaths(java.lang.String path)
path
- partial path used to match the resources, which must start with a '/'java.io.InputStream getResourceAsStream(java.lang.String path)
InputStream
object.path
- a String
specifying the path to the resourceInputStream
returned to the servlet,
or null
if no resource exists at the specified pathjava.lang.String getRealPath(java.lang.String path)
String
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.path
- a String
specifying a virtual pathString
specifying the real path, or null
if the
translation cannot be performed