Interface WebApplication

All Superinterfaces:
ServletContext
All Known Implementing Classes:
DefaultWebApplication, MicroWebApplication, ServerWebApplication

public interface WebApplication extends ServletContext
The WebApplication API.
Author:
Manfred Riem ([email protected])
  • Method Details

    • addFilterMapping

      default Set<String> addFilterMapping(String filterName, String... urlPatterns)
      Add a mapping for the given filter.
      Parameters:
      filterName - the filter name.
      urlPatterns - the URL patterns.
      Returns:
      the possible empty set of already mapped URL patterns.
      See Also:
    • addFilterMapping

      default Set<String> addFilterMapping(String filterName, boolean isMatchAfter, String... urlPatterns)
      Add a mapping for the given filter.
      Parameters:
      filterName - the filter name.
      isMatchAfter - true to call the filter this mapping applies to after declared ones, false to call it before declared ones.
      urlPatterns - the URL patterns.
      Returns:
      the possible empty set of already mapped URL patterns.
      See Also:
    • addFilterMapping

      Set<String> addFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, boolean isMatchAfter, String... urlPatterns)
      Add a mapping for the given filter.
      Parameters:
      dispatcherTypes - the dispatcher types. Can be null to use default DispatcherType.REQUEST.
      filterName - the filter name.
      isMatchAfter - true to call the filter this mapping applies to after declared ones, false to call it before declared ones.
      urlPatterns - the URL patterns.
      Returns:
      the possible empty set of already mapped URL patterns.
      See Also:
    • addInitializer

      void addInitializer(String className)
      Add a servlet container initializer.
      Parameters:
      className - the class name.
    • addInitializer

      void addInitializer(ServletContainerInitializer servletContainerInitializer)
      Add a servlet container initializer.
      Parameters:
      servletContainerInitializer - the servletContainerInitializer instance
    • addResource

      void addResource(Resource resource)
      Add the resource.
      Parameters:
      resource - the resouce.
    • addServletMapping

      Set<String> addServletMapping(String servletName, String... urlPatterns)
      Add a mapping for the given servlet.
      Parameters:
      servletName - the servlet name.
      urlPatterns - the URL patterns.
      Returns:
      the possible empty set of already mapped URL patterns.
      See Also:
    • destroy

      void destroy()
      Destroy the web application.
    • getDefaultServlet

      Servlet getDefaultServlet()
      Get the default servlet.
      Returns:
      the default Servlet.
    • getInitializers

      List<ServletContainerInitializer> getInitializers()
      Gets the ServletContainerInitializers
      Returns:
      list of ServletContainerInitializers
    • getManager

      WebApplicationManager getManager()
      Get the web application manager.
      Returns:
      the web application manager.
    • getMappings

      Collection<String> getMappings(String servletName)
      Get the mappings for a particular servlet.
      Parameters:
      servletName - the servlet name.
      Returns:
      the possible empty set of mapped URL patterns.
      See Also:
    • getRequest

      ServletRequest getRequest(ServletResponse response)
      Get the request.
      Parameters:
      response - the response.
      Returns:
      the request.
    • getResponse

      ServletResponse getResponse(ServletRequest request)
      Get the response.
      Parameters:
      request - the request.
      Returns:
      the response.
    • getServletContextId

      default String getServletContextId()
      Returns the unique Id of this web application corresponding to this ServletContext.
      Returns:
      the servlet context id.
    • initialize

      void initialize()
      Initialize the web application.
    • initializeDeclaredFinish

      void initializeDeclaredFinish()
      Marks the end of initializing declared (web.xml, annotations) artifacts
    • initializeFilters

      void initializeFilters()
      Initialize the filters.
    • initializeFinish

      void initializeFinish()
      Finish the initialization.
    • initializeInitializers

      void initializeInitializers()
      Initialize the servlet container initializers.
    • initializeServlets

      void initializeServlets()
      Initialize the servlets.
    • isDistributable

      boolean isDistributable()
      Is the application distributable.
      Returns:
      true if it is, false otherwise.
    • isInitialized

      boolean isInitialized()
      Is the web application initialized.
      Returns:
      true if it is, false otherwise.
    • isMetadataComplete

      boolean isMetadataComplete()
      Is the web application metadata complete.
      Returns:
      true if it is, false otherwise.
    • linkRequestAndResponse

      void linkRequestAndResponse(ServletRequest request, ServletResponse response)
      Link the request and response.
      Parameters:
      request - the request.
      response - the response.
    • removeServletMapping

      String removeServletMapping(String urlPattern)
      Remove a mapping for a servlet.
      Parameters:
      urlPattern - the URL pattern
      Returns:
      the Servlet name the pattern was mapped to, or null if no prior mapping.
    • service

      void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
      Service the request.
      Parameters:
      request - the request.
      response - the response.
      Throws:
      ServletException - when a servlet error occurs.
      IOException - when an I/O error occurs.
    • setClassLoader

      void setClassLoader(ClassLoader classLoader)
      Set the class loader.
      Parameters:
      classLoader - the class loader.
    • setContextPath

      void setContextPath(String contextPath)
      Set the context path.
      Parameters:
      contextPath - the context path.
    • setDefaultServlet

      void setDefaultServlet(Servlet defaultServlet)
      Set the default servlet.
      Parameters:
      defaultServlet - the default servlet.
    • setDistributable

      void setDistributable(boolean distributable)
      Set if the web application is distributable.
      Parameters:
      distributable - the distributable flag.
    • setEffectiveMajorVersion

      void setEffectiveMajorVersion(int version)
      Set the effective major version.
      Parameters:
      version - the effective major version.
    • setEffectiveMinorVersion

      void setEffectiveMinorVersion(int version)
      Set the effective minor version.
      Parameters:
      version - the effective minor version.
    • setMetadataComplete

      void setMetadataComplete(boolean metadataComplete)
      Set the metadata complete flag.
      Parameters:
      metadataComplete - the metadata complete flag.
    • setServletContextName

      void setServletContextName(String servletContextName)
      Set the servlet context name.
      Parameters:
      servletContextName - the servlet context name.
    • setWebApplicationRequestMapper

      void setWebApplicationRequestMapper(WebApplicationRequestMapper webApplicationRequestMapper)
      Set the web application request mapper.
      Parameters:
      webApplicationRequestMapper - the web application request mapper.
    • start

      void start()
      Start servicing.
    • stop

      void stop()
      Stop servicing.
    • unlinkRequestAndResponse

      void unlinkRequestAndResponse(ServletRequest request, ServletResponse response)
      Unlink the request and response.
      Parameters:
      request - the request.
      response - the response.