public class ContextImpl extends Object implements Context
Constructor and Description |
---|
ContextImpl(ServletContext servletContext) |
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name)
Returns an attribute previously stored into the context with the given name.
|
List<String> |
getAttributeNames()
Returns the names of all attributes of the context, sorted alphabetically.
|
String |
getInitParameter(String name)
Returns an initial parameter value defined by servlet.
|
String |
getMimeType(String file)
Returns the MIME content type of the specified file, or null if no content type is known.
|
File |
getRealFile(String path)
Attempts to find the actual file, on the file system, that would be provided by the servlet container for the
given path (which must start with a leading slash).
|
URL |
getResource(String path)
Returns a URL to a resource stored within the context.
|
List<String> |
getResourcePaths(String path)
Looks for resources within the web application within the supplied path.
|
public ContextImpl(ServletContext servletContext)
public URL getResource(String path)
Context
getResource
in interface Context
path
- to the resource (with a leading slash)public File getRealFile(String path)
Context
Context.getResource(String)
.getRealFile
in interface Context
path
- to the resource (with a leading slash)public String getInitParameter(String name)
Context
getInitParameter
in interface Context
public List<String> getResourcePaths(String path)
Context
getResourcePaths
in interface Context
path
- to search for (should start with a leading slash)public Object getAttribute(String name)
Context
getAttribute
in interface Context
name
- used to retrieve the attributepublic List<String> getAttributeNames()
Context
getAttributeNames
in interface Context
public String getMimeType(String file)
Context
getMimeType
in interface Context
file
- name of file5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.