Class ServletContainer

java.lang.Object
org.gatein.wci.ServletContainer

public final class ServletContainer extends Object
A static registry for the servlet container context.
  • Constructor Details

    • ServletContainer

      public ServletContainer()
  • Method Details

    • registerWebApp

      public void registerWebApp(WebAppContext webappContext, String dispatchPath)
      Manually register a webapp with this ServletContainerContext.
      Parameters:
      webappContext - the WebAppContext associated with the application
      dispatchPath - 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

      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(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 context
      response - the response valid in the current servlet context
      credentials - the credentials which try to authenticate
      Throws:
      AuthenticationException - when authentication fails
      IllegalStateException - when the user is already authenticated
      jakarta.servlet.ServletException - any servlet exception that would prevent authentication to be performed
      IOException - 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 context
      response - 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(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 to
      request - the request valid in the current servlet context
      response - the response valid in the current servlet context
      callback - the callback to perform after the dispatch operation
      handback - the handback object that will be provided to the callback
      Returns:
      the object returned by the callback
      Throws:
      jakarta.servlet.ServletException - any servlet exception
      IOException - any io exception
    • visit

      public void visit(ServletContainerVisitor visitor)
      Visit the registered WebApps
      Parameters:
      visitor - ServletContainerVisitor instance