Interface WebAppContext

All Known Implementing Classes:
CatalinaWebAppContext, SimpleWebAppContext

public interface WebAppContext
A web application context.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    fireRequestDestroyed(jakarta.servlet.ServletRequest servletRequest)
     
    void
    fireRequestInitialized(jakarta.servlet.ServletRequest servletRequest)
     
    Returns the class loader of the web application.
    Returns the context path of the web application.
    jakarta.servlet.http.HttpSession
    Returns Http session in case that session with sessId exists for this web application
    jakarta.servlet.ServletContext
    Returns the servlet context of the web application.
    boolean
    importFile(String parentDirRelativePath, String name, InputStream source, boolean overwrite)
    Import a file in the war file.
    void
    Start the web application context usage from a client point of view.
    void
    Stop the web application context usage.
  • Method Details

    • start

      void start() throws Exception
      Start the web application context usage from a client point of view. The life cycle is not related to the web application deployment life cycle. The invocation means that the servlet container spi framework want to start to use the web application.
      Throws:
      Exception - any exception that would veto the usage of the web application
    • stop

      void stop()
      Stop the web application context usage.
    • getServletContext

      jakarta.servlet.ServletContext getServletContext()
      Returns the servlet context of the web application.
      Returns:
      the servlet context
    • getClassLoader

      ClassLoader getClassLoader()
      Returns the class loader of the web application.
      Returns:
      the web application class loader
    • getContextPath

      String getContextPath()
      Returns the context path of the web application.
      Returns:
      the web application context path
    • importFile

      boolean importFile(String parentDirRelativePath, String name, InputStream source, boolean overwrite) throws IOException
      Import a file in the war file. The file could not be created for some reasons which are :
      • The parent dir exists and is a file
      • The parent dir does not exist and its creation failed
      • An underlying exception occurs when writing bytes from the source Inputstream to the target OutputStream
      Parameters:
      parentDirRelativePath - the parent relative path in the web app starting from the app root
      name - the name the created file should have
      source - the data of the target file
      overwrite - if false and the file already exists nothing is done
      Returns:
      true if the file has been created
      Throws:
      IOException - if the file cannot be created
    • getHttpSession

      jakarta.servlet.http.HttpSession getHttpSession(String sessId)
      Returns Http session in case that session with sessId exists for this web application
      Parameters:
      sessId -
      Returns:
      session with given ID or null if session with this ID doesn't exist
    • fireRequestInitialized

      void fireRequestInitialized(jakarta.servlet.ServletRequest servletRequest)
    • fireRequestDestroyed

      void fireRequestDestroyed(jakarta.servlet.ServletRequest servletRequest)