Package org.gatein.wci
Class ServletContainer
- java.lang.Object
-
- org.gatein.wci.ServletContainer
-
public final class ServletContainer extends Object
A static registry for the servlet container context.- Version:
- $Revision: 1.1 $
- Author:
- Julien Viet
-
-
Constructor Summary
Constructors Constructor Description ServletContainer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuthenticationListener(AuthenticationListener listener)Add the authentication listener.booleanaddWebAppListener(WebAppListener listener)Add a web listener.voidfireEvent(AuthenticationEvent event)StringgetContainerInfo()Returns the name and version of the servlet container in which the context is running.Objectinclude(javax.servlet.ServletContext targetServletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, RequestDispatchCallback callback, Object handback)Generic detyped request dispatch to a servlet context using the include mechanism.static booleanisDisabledNativeRegistration(javax.servlet.ServletContext servletContext)voidlogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Credentials credentials)Authentication support.voidlogout(javax.servlet.http.HttpServletRequest request, javax.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.voidremoveAuthenticationlistener(AuthenticationListener listener)Remove the authentication listener.booleanremoveWebAppListener(WebAppListener listener)Removes a web listener.voidunregisterWebApp(javax.servlet.ServletContext servletContext)Manually unregister a webapp associated with this ServletContainerContext.voidvisit(ServletContainerVisitor visitor)Visit the registered WebApps
-
-
-
Method Detail
-
registerWebApp
public void registerWebApp(WebAppContext webappContext, String dispatchPath)
Manually register a webapp with this ServletContainerContext.- Parameters:
webappContext- the WebAppContext associated with the applicationdispatchPath- the path to be used
-
unregisterWebApp
public void unregisterWebApp(javax.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(javax.servlet.ServletContext servletContext)
-
register
public void register(ServletContainerContext context)
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(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Credentials credentials) throws javax.servlet.ServletException, IOExceptionAuthentication 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 authenticatedjavax.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(javax.servlet.http.HttpServletRequest request, javax.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
public void addAuthenticationListener(AuthenticationListener listener)
Add the authentication listener.- Parameters:
listener- AuthenticationListener to add
-
removeAuthenticationlistener
public void removeAuthenticationlistener(AuthenticationListener listener)
Remove the authentication listener.- Parameters:
listener- AuthenticationListener to remove
-
getContainerInfo
public String 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
public boolean addWebAppListener(WebAppListener listener)
Add a web listener.- Parameters:
listener- the listener- Returns:
- true if the listener has been added
-
removeWebAppListener
public boolean removeWebAppListener(WebAppListener listener)
Removes a web listener.- Parameters:
listener- the listener- Returns:
- true if the listener has been removed
-
fireEvent
public void fireEvent(AuthenticationEvent event)
-
include
public Object include(javax.servlet.ServletContext targetServletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, RequestDispatchCallback callback, Object handback) throws javax.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:
javax.servlet.ServletException- any servlet exceptionIOException- any io exception
-
visit
public void visit(ServletContainerVisitor visitor)
Visit the registered WebApps- Parameters:
visitor- ServletContainerVisitor instance
-
-