public class ServletContextImpl extends ServletContextCompat implements ServletContext
ORDERED_LIBS, TEMPDIR
Constructor and Description |
---|
ServletContextImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
addAttributeListener(ServletContextAttributeListener listener)
Adds the listener.
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
java.lang.Class<? extends Filter> filterClass)
Adds a filter using filterClass
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
Filter filter)
Adds a dynamic filter registration using filter
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
java.lang.String className)
Adds a dynamic filter registration using className
|
void |
addListener(java.lang.Class<? extends java.util.EventListener> listenerClass) |
void |
addListener(ListenerConfig config) |
void |
addListener(java.lang.String className) |
<T extends java.util.EventListener> |
addListener(T t) |
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
java.lang.Class<? extends Servlet> servletClass)
Adds a servlet class to the servlet container.
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
Servlet servlet)
Adds a servlet to context
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
java.lang.String className)
Adds a servlet with the given className to context
|
<T extends Filter> |
createFilter(java.lang.Class<T> c)
Create a filter using class
|
<T extends java.util.EventListener> |
createListener(java.lang.Class<T> listenerClass) |
<T extends Servlet> |
createServlet(java.lang.Class<T> c)
Creates a servlet instance using the web-apps injection.
|
void |
declareRoles(java.lang.String... roleNames) |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the named attribute.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Returns an enumeration of the attribute names.
|
Path |
getCauchoPath(java.lang.String name) |
java.lang.ClassLoader |
getClassLoader() |
ServletContext |
getContext(java.lang.String uri)
Returns the servlet context for the name.
|
java.lang.String |
getContextPath()
Gets the servlet context name
|
int |
getEffectiveMajorVersion() |
int |
getEffectiveMinorVersion() |
FilterRegistration |
getFilterRegistration(java.lang.String filterName)
Returns filter registration sing filterName
|
java.util.Map<java.lang.String,? extends FilterRegistration> |
getFilterRegistrations()
Returns filter registrations
|
java.lang.String |
getInitParameter(java.lang.String name)
Gets the init params
|
java.util.Enumeration<java.lang.String> |
getInitParameterNames()
Gets the init params
|
JspConfigDescriptor |
getJspConfigDescriptor() |
int |
getMajorVersion()
Returns the servlet major version
|
java.lang.String |
getMimeType(java.lang.String uri)
Returns the mime type for the name.
|
int |
getMinorVersion()
Returns the servlet minor version
|
RequestDispatcher |
getNamedDispatcher(java.lang.String servletName)
Returns a dispatcher for the named servlet.
|
java.lang.String |
getRealPath(java.lang.String uri)
Maps from a URI to a real path.
|
RequestDispatcher |
getRequestDispatcher(java.lang.String uri)
Returns the dispatcher.
|
java.net.URL |
getResource(java.lang.String name)
Returns a resource for the given uri.
|
java.net.URLConnection |
getResource(java.net.URL url) |
java.io.InputStream |
getResourceAsStream(java.lang.String uripath)
Returns the resource for a uripath as an input stream.
|
java.util.Set<java.lang.String> |
getResourcePaths(java.lang.String prefix)
Returns an enumeration of all the resources.
|
Path |
getRootDirectory() |
java.lang.String |
getServerInfo()
Returns the server information
|
Servlet |
getServlet(java.lang.String name) |
java.lang.String |
getServletContextName()
Gets the servlet context name
|
java.util.Enumeration<java.lang.String> |
getServletNames() |
ServletRegistration |
getServletRegistration(java.lang.String servletName)
Returs servlet registration using servletName
|
java.util.Map<java.lang.String,ServletRegistration> |
getServletRegistrations()
Returns servlet registrations
|
java.util.Enumeration<Servlet> |
getServlets() |
protected boolean |
isActive() |
void |
log(java.lang.Exception e,
java.lang.String msg)
Deprecated.
|
void |
log(java.lang.String message)
Logs a message to the error file.
|
void |
log(java.lang.String message,
java.lang.Throwable e)
Error logging
|
void |
removeAttribute(java.lang.String name)
Removes an attribute from the servlet context.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets an application attribute.
|
void |
setDisplayName(java.lang.String name)
Sets the servlet context name
|
protected void |
setInitParam(java.lang.String name,
java.lang.String value)
Sets an init param
|
boolean |
setInitParameter(java.lang.String name,
java.lang.String value)
Sets an init param
|
void |
setSessionTrackingModes(java.util.Set<SessionTrackingMode> modes)
The session tracking mode
|
getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getSessionCookieConfig, setSessionTrackingModes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getSessionCookieConfig
public Path getRootDirectory()
public void setDisplayName(java.lang.String name)
public java.lang.String getServletContextName()
getServletContextName
in interface ServletContext
public java.lang.String getContextPath()
getContextPath
in interface ServletContext
protected void addAttributeListener(ServletContextAttributeListener listener)
public java.lang.String getServerInfo()
getServerInfo
in interface ServletContext
public int getMajorVersion()
getMajorVersion
in interface ServletContext
public int getEffectiveMajorVersion()
getEffectiveMajorVersion
in interface ServletContext
public int getMinorVersion()
getMinorVersion
in interface ServletContext
public int getEffectiveMinorVersion()
getEffectiveMinorVersion
in interface ServletContext
public boolean setInitParameter(java.lang.String name, java.lang.String value)
setInitParameter
in interface ServletContext
protected void setInitParam(java.lang.String name, java.lang.String value)
public java.lang.String getInitParameter(java.lang.String name)
getInitParameter
in interface ServletContext
name
- init parameter namepublic java.util.Enumeration<java.lang.String> getInitParameterNames()
getInitParameterNames
in interface ServletContext
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface ServletContext
name
- of the attribute.public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface ServletContext
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface ServletContext
name
- the name of the attributevalue
- the value of the attributepublic void removeAttribute(java.lang.String name)
removeAttribute
in interface ServletContext
name
- the name of the attribute to remove.public java.lang.String getRealPath(java.lang.String uri)
getRealPath
in interface ServletContext
uri
- path relative to the application root to be translated.public java.net.URL getResource(java.lang.String name) throws java.net.MalformedURLException
XXX: jdk 1.1.x doesn't appear to allow creation of private URL streams.
getResource
in interface ServletContext
name
- path relative to the application root.java.net.MalformedURLException
public java.net.URLConnection getResource(java.net.URL url) throws java.io.IOException
java.io.IOException
public Path getCauchoPath(java.lang.String name)
public java.io.InputStream getResourceAsStream(java.lang.String uripath)
getResourceAsStream
in interface ServletContext
uripath
- path relative to the application root.public java.util.Set<java.lang.String> getResourcePaths(java.lang.String prefix)
getResourcePaths
in interface ServletContext
public ServletContext getContext(java.lang.String uri)
getContext
in interface ServletContext
uri
- path relative to the rootpublic java.lang.String getMimeType(java.lang.String uri)
getMimeType
in interface ServletContext
uri
- path relative to the application root.public RequestDispatcher getRequestDispatcher(java.lang.String uri)
getRequestDispatcher
in interface ServletContext
uri
- path relative to the app root (including query string)
for the included file.public RequestDispatcher getNamedDispatcher(java.lang.String servletName)
getNamedDispatcher
in interface ServletContext
servletName
- the servlet name to include or forward to.public final void log(java.lang.String message)
log
in interface ServletContext
msg
- the message to logpublic final void log(java.lang.Exception e, java.lang.String msg)
log
in interface ServletContext
public void log(java.lang.String message, java.lang.Throwable e)
log
in interface ServletContext
message
- message to loge
- stack trace of the errorpublic Servlet getServlet(java.lang.String name)
getServlet
in interface ServletContext
public java.util.Enumeration<java.lang.String> getServletNames()
getServletNames
in interface ServletContext
public java.util.Enumeration<Servlet> getServlets()
getServlets
in interface ServletContext
public void setSessionTrackingModes(java.util.Set<SessionTrackingMode> modes)
ServletContext
setSessionTrackingModes
in interface ServletContext
public ServletRegistration.Dynamic addServlet(java.lang.String servletName, java.lang.String className)
ServletContext
addServlet
in interface ServletContext
public ServletRegistration.Dynamic addServlet(java.lang.String servletName, Servlet servlet)
ServletContext
addServlet
in interface ServletContext
public ServletRegistration.Dynamic addServlet(java.lang.String servletName, java.lang.Class<? extends Servlet> servletClass)
ServletContext
addServlet
in interface ServletContext
public <T extends Servlet> T createServlet(java.lang.Class<T> c) throws ServletException
ServletContext
createServlet
in interface ServletContext
ServletException
public ServletRegistration getServletRegistration(java.lang.String servletName)
ServletContext
getServletRegistration
in interface ServletContext
public java.util.Map<java.lang.String,ServletRegistration> getServletRegistrations()
ServletContext
getServletRegistrations
in interface ServletContext
public FilterRegistration.Dynamic addFilter(java.lang.String filterName, java.lang.String className)
ServletContext
addFilter
in interface ServletContext
public FilterRegistration.Dynamic addFilter(java.lang.String filterName, Filter filter)
ServletContext
addFilter
in interface ServletContext
public FilterRegistration.Dynamic addFilter(java.lang.String filterName, java.lang.Class<? extends Filter> filterClass)
ServletContext
addFilter
in interface ServletContext
public <T extends Filter> T createFilter(java.lang.Class<T> c) throws ServletException
ServletContext
createFilter
in interface ServletContext
ServletException
public FilterRegistration getFilterRegistration(java.lang.String filterName)
ServletContext
getFilterRegistration
in interface ServletContext
public java.util.Map<java.lang.String,? extends FilterRegistration> getFilterRegistrations()
getFilterRegistrations
in interface ServletContext
@Configurable public void addListener(ListenerConfig config) throws java.lang.Exception
java.lang.Exception
public void addListener(java.lang.String className)
addListener
in interface ServletContext
public <T extends java.util.EventListener> void addListener(T t)
addListener
in interface ServletContext
public void addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)
addListener
in interface ServletContext
public JspConfigDescriptor getJspConfigDescriptor()
getJspConfigDescriptor
in interface ServletContext
public java.lang.ClassLoader getClassLoader()
getClassLoader
in interface ServletContext
public void declareRoles(java.lang.String... roleNames)
declareRoles
in interface ServletContext
protected boolean isActive()
public <T extends java.util.EventListener> T createListener(java.lang.Class<T> listenerClass) throws ServletException
createListener
in interface ServletContext
ServletException