|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jetty.server.handler.ContextHandler.Context
org.eclipse.jetty.servlet.ServletContextHandler.Context
public class ServletContextHandler.Context
| Field Summary |
|---|
| Fields inherited from class org.eclipse.jetty.server.handler.ContextHandler.Context |
|---|
_enabled, _majorVersion, _minorVersion |
| Fields inherited from interface javax.servlet.ServletContext |
|---|
ORDERED_LIBS, TEMPDIR |
| Constructor Summary | |
|---|---|
ServletContextHandler.Context()
|
|
| Method Summary | ||
|---|---|---|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
java.lang.Class<? extends Filter> filterClass)
Adds the filter with the given name and class type to this servlet context. |
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
Filter filter)
Registers the given filter instance with this ServletContext under the given filterName. |
|
FilterRegistration.Dynamic |
addFilter(java.lang.String filterName,
java.lang.String className)
Adds the filter with the given name and class name to this servlet context. |
|
void |
addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)
Adds a listener of the given class type to this ServletContext. |
|
void |
addListener(java.lang.String className)
Adds the listener with the given class name to this ServletContext. |
|
|
addListener(T t)
Adds the given listener to this ServletContext. |
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
java.lang.Class<? extends Servlet> servletClass)
Adds the servlet with the given name and class type to this servlet context. |
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
Servlet servlet)
Registers the given servlet instance with this ServletContext under the given servletName. |
|
ServletRegistration.Dynamic |
addServlet(java.lang.String servletName,
java.lang.String className)
Adds the servlet with the given name and class name to this servlet context. |
|
|
createFilter(java.lang.Class<T> c)
Instantiates the given Filter class. |
|
|
createListener(java.lang.Class<T> clazz)
Instantiates the given EventListener class. |
|
|
createServlet(java.lang.Class<T> c)
Instantiates the given Servlet class. |
|
void |
declareRoles(java.lang.String... roleNames)
Declares role names that are tested using isUserInRole. |
|
java.util.Set<SessionTrackingMode> |
getDefaultSessionTrackingModes()
Gets the session tracking modes that are supported by default for this ServletContext. |
|
java.util.Set<SessionTrackingMode> |
getEffectiveSessionTrackingModes()
Gets the session tracking modes that are in effect for this ServletContext. |
|
FilterRegistration |
getFilterRegistration(java.lang.String filterName)
Gets the FilterRegistration corresponding to the filter with the given filterName. |
|
java.util.Map<java.lang.String,? extends FilterRegistration> |
getFilterRegistrations()
Gets a (possibly empty) Map of the FilterRegistration objects (keyed by filter name) corresponding to all filters registered with this ServletContext. |
|
JspConfigDescriptor |
getJspConfigDescriptor()
Gets the <jsp-config> related configuration
that was aggregated from the web.xml and
web-fragment.xml descriptor files of the web application
represented by this ServletContext. |
|
RequestDispatcher |
getNamedDispatcher(java.lang.String name)
Returns a RequestDispatcher object that acts
as a wrapper for the named servlet. |
|
ServletRegistration |
getServletRegistration(java.lang.String servletName)
Gets the ServletRegistration corresponding to the servlet with the given servletName. |
|
java.util.Map<java.lang.String,? extends ServletRegistration> |
getServletRegistrations()
Gets a (possibly empty) Map of the ServletRegistration objects (keyed by servlet name) corresponding to all servlets registered with this ServletContext. |
|
SessionCookieConfig |
getSessionCookieConfig()
Gets the SessionCookieConfig object through which various
properties of the session tracking cookies created on behalf of this
ServletContext may be configured. |
|
boolean |
setInitParameter(java.lang.String name,
java.lang.String value)
Sets the context initialization parameter with the given name and value on this ServletContext. |
|
void |
setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
Sets the session tracking modes that are to become effective for this ServletContext. |
|
| Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler.Context |
|---|
getAttribute, getAttributeNames, getClassLoader, getContext, getContextHandler, getContextPath, getEffectiveMajorVersion, getEffectiveMinorVersion, getInitParameter, getInitParameterNames, getMajorVersion, getMimeType, getMinorVersion, getRealPath, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, isEnabled, log, log, log, removeAttribute, setAttribute, setEffectiveMajorVersion, setEffectiveMinorVersion, setEnabled, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ServletContextHandler.Context()
| Method Detail |
|---|
public RequestDispatcher getNamedDispatcher(java.lang.String name)
ServletContextRequestDispatcher object that acts
as a wrapper for the named servlet.
Servlets (and JSP pages also) may be given names via server
administration or via a web application deployment descriptor.
A servlet instance can determine its name using
ServletConfig.getServletName().
This method returns null if the
ServletContext
cannot return a RequestDispatcher for any reason.
getNamedDispatcher in interface ServletContextgetNamedDispatcher in class ContextHandler.Contextname - a String specifying the name
of a servlet to wrap
RequestDispatcher object
that acts as a wrapper for the named servlet,
or null if the ServletContext
cannot return a RequestDispatcherRequestDispatcher,
ServletContext.getContext(java.lang.String),
ServletConfig.getServletName()
public FilterRegistration.Dynamic addFilter(java.lang.String filterName,
java.lang.Class<? extends Filter> filterClass)
ServletContextThe registered filter may be further configured via the returned
FilterRegistration object.
If this ServletContext already contains a preliminary FilterRegistration for a filter with the given filterName, it will be completed (by assigning the name of the given filterClass to it) and returned.
This method supports resource injection if the given filterClass represents a Managed Bean. See the Java EE platform and JSR 299 specifications for additional details about Managed Beans and resource injection.
addFilter in interface ServletContextaddFilter in class ContextHandler.ContextfilterName - the name of the filterfilterClass - the class object from which the filter will be
instantiated
ServletContext.addFilter(java.lang.String, java.lang.Class)
public FilterRegistration.Dynamic addFilter(java.lang.String filterName,
java.lang.String className)
ServletContextThe registered filter may be further configured via the returned
FilterRegistration object.
The specified className will be loaded using the classloader associated with the application represented by this ServletContext.
If this ServletContext already contains a preliminary FilterRegistration for a filter with the given filterName, it will be completed (by assigning the given className to it) and returned.
This method supports resource injection if the class with the given className represents a Managed Bean. See the Java EE platform and JSR 299 specifications for additional details about Managed Beans and resource injection.
addFilter in interface ServletContextaddFilter in class ContextHandler.ContextfilterName - the name of the filterclassName - the fully qualified class name of the filter
ServletContext.addFilter(java.lang.String, java.lang.String)
public FilterRegistration.Dynamic addFilter(java.lang.String filterName,
Filter filter)
ServletContextThe registered filter may be further configured via the returned
FilterRegistration object.
If this ServletContext already contains a preliminary FilterRegistration for a filter with the given filterName, it will be completed (by assigning the class name of the given filter instance to it) and returned.
addFilter in interface ServletContextaddFilter in class ContextHandler.ContextfilterName - the name of the filterfilter - the filter instance to register
ServletContext.addFilter(java.lang.String, javax.servlet.Filter)
public ServletRegistration.Dynamic addServlet(java.lang.String servletName,
java.lang.Class<? extends Servlet> servletClass)
ServletContextThe registered servlet may be further configured via the returned
ServletRegistration object.
If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given servletName, it will be completed (by assigning the name of the given servletClass to it) and returned.
This method introspects the given servletClass for
the ServletSecurity,
MultipartConfig,
javax.annotation.security.RunAs, and
javax.annotation.security.DeclareRoles annotations.
In addition, this method supports resource injection if the
given servletClass represents a Managed Bean.
See the Java EE platform and JSR 299 specifications for additional
details about Managed Beans and resource injection.
addServlet in interface ServletContextaddServlet in class ContextHandler.ContextservletName - the name of the servletservletClass - the class object from which the servlet will be
instantiated
ServletContext.addServlet(java.lang.String, java.lang.Class)
public ServletRegistration.Dynamic addServlet(java.lang.String servletName,
java.lang.String className)
ServletContextThe registered servlet may be further configured via the returned
ServletRegistration object.
The specified className will be loaded using the classloader associated with the application represented by this ServletContext.
If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given servletName, it will be completed (by assigning the given className to it) and returned.
This method introspects the class with the given className
for the ServletSecurity,
MultipartConfig,
javax.annotation.security.RunAs, and
javax.annotation.security.DeclareRoles annotations.
In addition, this method supports resource injection if the
class with the given className represents a Managed Bean.
See the Java EE platform and JSR 299 specifications for additional
details about Managed Beans and resource injection.
addServlet in interface ServletContextaddServlet in class ContextHandler.ContextservletName - the name of the servletclassName - the fully qualified class name of the servlet
ServletContext.addServlet(java.lang.String, java.lang.String)
public ServletRegistration.Dynamic addServlet(java.lang.String servletName,
Servlet servlet)
ServletContextThe registered servlet may be further configured via the returned
ServletRegistration object.
If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given servletName, it will be completed (by assigning the class name of the given servlet instance to it) and returned.
addServlet in interface ServletContextaddServlet in class ContextHandler.ContextservletName - the name of the servletservlet - the servlet instance to register
public boolean setInitParameter(java.lang.String name,
java.lang.String value)
ServletContext
setInitParameter in interface ServletContextsetInitParameter in class ContextHandler.Contextname - the name of the context initialization parameter to setvalue - the value of the context initialization parameter to set
public <T extends Filter> T createFilter(java.lang.Class<T> c)
throws ServletException
ServletContextThe returned Filter instance may be further customized before it
is registered with this ServletContext via a call to
ServletContext.addFilter(String,Filter).
The given Filter class must define a zero argument constructor, which is used to instantiate it.
This method supports resource injection if the given clazz represents a Managed Bean. See the Java EE platform and JSR 299 specifications for additional details about Managed Beans and resource injection.
createFilter in interface ServletContextcreateFilter in class ContextHandler.Contextc - the Filter class to instantiate
ServletException - if the given clazz fails to be
instantiated
public <T extends Servlet> T createServlet(java.lang.Class<T> c)
throws ServletException
ServletContextThe returned Servlet instance may be further customized before it
is registered with this ServletContext via a call to
ServletContext.addServlet(String,Servlet).
The given Servlet class must define a zero argument constructor, which is used to instantiate it.
This method introspects the given clazz for
the following annotations:
ServletSecurity,
MultipartConfig,
javax.annotation.security.RunAs, and
javax.annotation.security.DeclareRoles.
In addition, this method supports resource injection if the
given clazz represents a Managed Bean.
See the Java EE platform and JSR 299 specifications for additional
details about Managed Beans and resource injection.
createServlet in interface ServletContextcreateServlet in class ContextHandler.Contextc - the Servlet class to instantiate
ServletException - if the given clazz fails to be
instantiatedpublic java.util.Set<SessionTrackingMode> getDefaultSessionTrackingModes()
ServletContext
getDefaultSessionTrackingModes in interface ServletContextgetDefaultSessionTrackingModes in class ContextHandler.Contextpublic java.util.Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
ServletContextThe session tracking modes in effect are those provided to
setSessionTrackingModes.
By default, the session tracking modes returned by
getDefaultSessionTrackingModes
are in effect.
getEffectiveSessionTrackingModes in interface ServletContextgetEffectiveSessionTrackingModes in class ContextHandler.Contextpublic FilterRegistration getFilterRegistration(java.lang.String filterName)
ServletContext
getFilterRegistration in interface ServletContextgetFilterRegistration in class ContextHandler.Contextpublic java.util.Map<java.lang.String,? extends FilterRegistration> getFilterRegistrations()
ServletContextThe returned Map includes the FilterRegistration objects corresponding to all declared and annotated filters, as well as the FilterRegistration objects corresponding to all filters that have been added via one of the addFilter methods.
Any changes to the returned Map must not affect this ServletContext.
getFilterRegistrations in interface ServletContextgetFilterRegistrations in class ContextHandler.Contextpublic ServletRegistration getServletRegistration(java.lang.String servletName)
ServletContext
getServletRegistration in interface ServletContextgetServletRegistration in class ContextHandler.Contextpublic java.util.Map<java.lang.String,? extends ServletRegistration> getServletRegistrations()
ServletContextThe returned Map includes the ServletRegistration objects corresponding to all declared and annotated servlets, as well as the ServletRegistration objects corresponding to all servlets that have been added via one of the addServlet methods.
Any changes to the returned Map must not affect this ServletContext.
getServletRegistrations in interface ServletContextgetServletRegistrations in class ContextHandler.Contextpublic SessionCookieConfig getSessionCookieConfig()
ServletContextSessionCookieConfig object through which various
properties of the session tracking cookies created on behalf of this
ServletContext may be configured.
Repeated invocations of this method will return the same SessionCookieConfig instance.
getSessionCookieConfig in interface ServletContextgetSessionCookieConfig in class ContextHandler.Contextpublic void setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
ServletContextThe given sessionTrackingModes replaces any session tracking modes set by a previous invocation of this method on this ServletContext.
setSessionTrackingModes in interface ServletContextsetSessionTrackingModes in class ContextHandler.ContextsessionTrackingModes - the set of session tracking modes to
become effective for this ServletContextpublic void addListener(java.lang.String className)
ServletContextThe class with the given name will be loaded using the classloader associated with the application represented by this ServletContext, and must implement one or more of the following interfaces:
ServletContextAttributeListener
ServletRequestListener
ServletRequestAttributeListener
HttpSessionListener
HttpSessionAttributeListener
If this ServletContext was passed to
ServletContainerInitializer.onStartup(java.util.Set, then the class with
the given name may also implement ServletContextListener,
in addition to the interfaces listed above.
As part of this method call, the container must load the class with the specified class name to ensure that it implements one of the required interfaces.
If the class with the given name implements a listener interface
whose invocation order corresponds to the declaration order (i.e.,
if it implements ServletRequestListener,
ServletContextListener, or
HttpSessionListener),
then the new listener will be added to the end of the ordered list of
listeners of that interface.
This method supports resource injection if the class with the given className represents a Managed Bean. See the Java EE platform and JSR 299 specifications for additional details about Managed Beans and resource injection.
addListener in interface ServletContextaddListener in class ContextHandler.ContextclassName - the fully qualified class name of the listenerpublic <T extends java.util.EventListener> void addListener(T t)
ServletContextThe given listener must be an instance of one or more of the following interfaces:
ServletContextAttributeListener
ServletRequestListener
ServletRequestAttributeListener
HttpSessionListener
HttpSessionAttributeListener
If this ServletContext was passed to
ServletContainerInitializer.onStartup(java.util.Set, then the given
listener may also be an instance of ServletContextListener,
in addition to the interfaces listed above.
If the given listener is an instance of a listener interface whose
invocation order corresponds to the declaration order (i.e., if it
is an instance of ServletRequestListener,
ServletContextListener, or
HttpSessionListener),
then the listener will be added to the end of the ordered list of
listeners of that interface.
addListener in interface ServletContextaddListener in class ContextHandler.Contextt - the listener to be addedpublic void addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)
ServletContextThe given listenerClass must implement one or more of the following interfaces:
ServletContextAttributeListener
ServletRequestListener
ServletRequestAttributeListener
HttpSessionListener
HttpSessionAttributeListener
If this ServletContext was passed to
ServletContainerInitializer.onStartup(java.util.Set, then the given
listenerClass may also implement
ServletContextListener, in addition to the interfaces listed
above.
If the given listenerClass implements a listener
interface whose invocation order corresponds to the declaration order
(i.e., if it implements ServletRequestListener,
ServletContextListener, or
HttpSessionListener),
then the new listener will be added to the end of the ordered list
of listeners of that interface.
This method supports resource injection if the given listenerClass represents a Managed Bean. See the Java EE platform and JSR 299 specifications for additional details about Managed Beans and resource injection.
addListener in interface ServletContextaddListener in class ContextHandler.ContextlistenerClass - the listener class to be instantiated
public <T extends java.util.EventListener> T createListener(java.lang.Class<T> clazz)
throws ServletException
ServletContextThe specified EventListener class must implement at least one of
the ,
ServletContextListener,
ServletContextAttributeListener,
ServletRequestListener,
ServletRequestAttributeListener, or
HttpSessionListener
interfaces.
HttpSessionAttributeListener
The returned EventListener instance may be further customized
before it is registered with this ServletContext via a call to
ServletContext.addListener(EventListener).
The given EventListener class must define a zero argument constructor, which is used to instantiate it.
This method supports resource injection if the given clazz represents a Managed Bean. See the Java EE platform and JSR 299 specifications for additional details about Managed Beans and resource injection.
createListener in interface ServletContextcreateListener in class ContextHandler.Contextclazz - the EventListener class to instantiate
ServletException - if the given clazz fails to be
instantiatedpublic JspConfigDescriptor getJspConfigDescriptor()
ServletContext<jsp-config> related configuration
that was aggregated from the web.xml and
web-fragment.xml descriptor files of the web application
represented by this ServletContext.
getJspConfigDescriptor in interface ServletContextgetJspConfigDescriptor in class ContextHandler.Context<jsp-config> related configuration
that was aggregated from the web.xml and
web-fragment.xml descriptor files of the web application
represented by this ServletContext, or null if no such configuration
existsJspConfigDescriptorpublic void declareRoles(java.lang.String... roleNames)
ServletContextisUserInRole.
Roles that are implicitly declared as a result of their use within
the setServletSecurity or setRunAsRole methods of the ServletRegistration interface need
not be declared.
declareRoles in interface ServletContextdeclareRoles in class ContextHandler.ContextroleNames - the role names being declared
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||