Package org.gatein.wci
Class ServletContainer
java.lang.Object
org.gatein.wci.ServletContainer
A static registry for the servlet container context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the authentication listener.booleanaddWebAppListener(WebAppListener listener) Add a web listener.voidfireEvent(AuthenticationEvent event) Returns the name and version of the servlet container in which the context is running.include(jakarta.servlet.ServletContext targetServletContext, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, RequestDispatchCallback callback, Object handback) Generic detyped request dispatch to a servlet context using the include mechanism.static booleanisDisabledNativeRegistration(jakarta.servlet.ServletContext servletContext) voidlogin(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Credentials credentials) Authentication support.voidlogout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Authentication support.voidregister(ServletContainerContext context) Register a servlet container context.voidregisterWebApp(WebAppContext webappContext, String dispatchPath) Manually register a webapp with this ServletContainerContext.voidRemove the authentication listener.booleanremoveWebAppListener(WebAppListener listener) Removes a web listener.voidunregisterWebApp(jakarta.servlet.ServletContext servletContext) Manually unregister a webapp associated with this ServletContainerContext.voidvisit(ServletContainerVisitor visitor) Visit the registered WebApps
-
Constructor Details
-
ServletContainer
public ServletContainer()
-
-
Method Details
-
registerWebApp
Manually register a webapp with this ServletContainerContext.- Parameters:
webappContext- the WebAppContext associated with the applicationdispatchPath- the path to be used
-
unregisterWebApp
public void unregisterWebApp(jakarta.servlet.ServletContext servletContext) Manually unregister a webapp associated with this ServletContainerContext.- Parameters:
servletContext- the servletContext of the application to be deregistered
-
isDisabledNativeRegistration
public static boolean isDisabledNativeRegistration(jakarta.servlet.ServletContext servletContext) -
register
Register a servlet container context. The registration is considered as successful if no existing context is already registered.- Parameters:
context- the servlet container context to register- Throws:
IllegalArgumentException- if the context is null
-
login
public void login(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Credentials credentials) throws jakarta.servlet.ServletException, IOException Authentication support.- Parameters:
request- the request valid in the current servlet contextresponse- the response valid in the current servlet contextcredentials- the credentials which try to authenticate- Throws:
AuthenticationException- when authentication failsIllegalStateException- when the user is already authenticatedjakarta.servlet.ServletException- any servlet exception that would prevent authentication to be performedIOException- any io exception that would prevent authentication to be performed
-
logout
public void logout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Authentication support.- Parameters:
request- the request valid in the current servlet contextresponse- the response valid in the current servlet context- Throws:
IllegalStateException- when the user is not authenticated
-
addAuthenticationListener
Add the authentication listener.- Parameters:
listener- AuthenticationListener to add
-
removeAuthenticationlistener
Remove the authentication listener.- Parameters:
listener- AuthenticationListener to remove
-
getContainerInfo
Returns the name and version of the servlet container in which the context is running.The form of the returned string is
containername/versionnumber.- Returns:
- the string containing at least name and version number
-
addWebAppListener
Add a web listener.- Parameters:
listener- the listener- Returns:
- true if the listener has been added
-
removeWebAppListener
Removes a web listener.- Parameters:
listener- the listener- Returns:
- true if the listener has been removed
-
fireEvent
-
include
public Object include(jakarta.servlet.ServletContext targetServletContext, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, RequestDispatchCallback callback, Object handback) throws jakarta.servlet.ServletException, IOException Generic detyped request dispatch to a servlet context using the include mechanism.- Parameters:
targetServletContext- the target servlet context to dispatch torequest- the request valid in the current servlet contextresponse- the response valid in the current servlet contextcallback- the callback to perform after the dispatch operationhandback- the handback object that will be provided to the callback- Returns:
- the object returned by the callback
- Throws:
jakarta.servlet.ServletException- any servlet exceptionIOException- any io exception
-
visit
Visit the registered WebApps- Parameters:
visitor- ServletContainerVisitor instance
-