Package org.glassfish.embeddable.web
Interface Context
-
- All Superinterfaces:
jakarta.servlet.ServletContext
- All Known Implementing Classes:
AdHocWebModule
,ContextFacade
,WebModule
public interface Context extends jakarta.servlet.ServletContext
Representation of a web application. SeeWebContainer
for usage example.- Author:
- Rajiv Mordani, Jan Luehe
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(Class<? extends EventListener> c)
Instantiates a listener from the given class and registers it with this Context.<T extends EventListener>
voidaddListener(T t)
Registers the given listener with this Context.String
getPath()
Return the context path for this Context.SecurityConfig
getSecurityConfig()
Gets the security related configuration for this contextboolean
isDirectoryListing()
Checks whether directory listings are enabled or disabled on this Context.void
setDefaultWebXml(String defaultWebXml)
Set the location of the default web xml that will be used.void
setDirectoryListing(boolean directoryListing)
Enables or disables directory listings on this Context.void
setPath(String path)
Set the context path for this Context.void
setSecurityConfig(SecurityConfig config)
Set the security related configuration for this context-
Methods inherited from interface jakarta.servlet.ServletContext
addFilter, addFilter, addFilter, addJspFile, addListener, addServlet, addServlet, addServlet, createFilter, createListener, createServlet, declareRoles, getAttribute, getAttributeNames, getClassLoader, getContext, getContextPath, getDefaultSessionTrackingModes, getEffectiveMajorVersion, getEffectiveMinorVersion, getEffectiveSessionTrackingModes, getFilterRegistration, getFilterRegistrations, getInitParameter, getInitParameterNames, getJspConfigDescriptor, getMajorVersion, getMimeType, getMinorVersion, getNamedDispatcher, getRealPath, getRequestCharacterEncoding, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getResponseCharacterEncoding, getServerInfo, getServletContextName, getServletRegistration, getServletRegistrations, getSessionCookieConfig, getSessionTimeout, getVirtualServerName, log, log, removeAttribute, setAttribute, setInitParameter, setRequestCharacterEncoding, setResponseCharacterEncoding, setSessionTimeout, setSessionTrackingModes
-
-
-
-
Method Detail
-
addListener
<T extends EventListener> void addListener(T t)
Registers the given listener with this Context.The given listener must be an instance of one or more of the following interfaces:
- jakarta.servlet.ServletContextAttributeListener
- jakarta.servlet.ServletRequestAttributeListener
- jakarta.servlet.ServletRequestListener
- jakarta.servlet.ServletContextListener
- jakarta.servlet.http.HttpSessionAttributeListener
- jakarta.servlet.http.HttpSessionIdListener
- jakarta.servlet.http.HttpSessionListener
- Specified by:
addListener
in interfacejakarta.servlet.ServletContext
- Parameters:
t
- the listener to be registered with this Context- Throws:
IllegalArgumentException
- if the given listener is not an instance of any of the above interfacesIllegalStateException
- if this context has already been initialized and started
-
addListener
void addListener(Class<? extends EventListener> c)
Instantiates a listener from the given class and registers it with this Context.The given listener must be an instance of one or more of the following interfaces:
- jakarta.servlet.ServletContextAttributeListener
- jakarta.servlet.ServletRequestAttributeListener
- jakarta.servlet.ServletRequestListener
- jakarta.servlet.ServletContextListener
- jakarta.servlet.http.HttpSessionAttributeListener
- jakarta.servlet.http.HttpSessionListener
- Specified by:
addListener
in interfacejakarta.servlet.ServletContext
- Parameters:
c
- the class from which to instantiate of the listener- Throws:
IllegalArgumentException
- if the given class does not implement any of the above interfacesIllegalStateException
- if this context has already been initialized and started
-
setDirectoryListing
void setDirectoryListing(boolean directoryListing)
Enables or disables directory listings on this Context.- Parameters:
directoryListing
- true if directory listings are to be enabled on this Context, false otherwise
-
isDirectoryListing
boolean isDirectoryListing()
Checks whether directory listings are enabled or disabled on this Context.- Returns:
- true if directory listings are enabled on this Context, false otherwise
-
setSecurityConfig
void setSecurityConfig(SecurityConfig config)
Set the security related configuration for this context- Parameters:
config
- the security configuration for this context- See Also:
SecurityConfig
-
getSecurityConfig
SecurityConfig getSecurityConfig()
Gets the security related configuration for this context- Returns:
- the security configuration for this context
- See Also:
SecurityConfig
-
setDefaultWebXml
void setDefaultWebXml(String defaultWebXml)
Set the location of the default web xml that will be used.- Parameters:
defaultWebXml
- the defaultWebXml path to be used
-
getPath
String getPath()
Return the context path for this Context.
-
setPath
void setPath(String path)
Set the context path for this Context.
-
-