Class WebFragmentRegistrationBean

  • All Implemented Interfaces:
    org.springframework.boot.web.server.WebServerFactoryCustomizer<org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory>

    public class WebFragmentRegistrationBean
    extends java.lang.Object
    implements org.springframework.boot.web.server.WebServerFactoryCustomizer<org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory>
    RegistrationBean for web-fragment.xml files.

    This is implemented as WebServerFactoryCustomizer so it only applies to embedded servlet-containers. When deployed as war file, the external servlet-container will find the web-fragment.xml file.

    The main feature of this class is the way it registers listeners. They will be treated as if they were declared in a web-fragment.xml and therefore aren't affected by the restrictions of Section 4.4 of the Servlet Specification.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  WebFragmentRegistrationBean.JettyListenerAdder
      This Configuration adds listeners to the servlet-context in a non-programmatic way, so they aren't affected by the restrictions for programmatically registered listeners of Section 4.4 of the Servlet Specification.
      static class  WebFragmentRegistrationBean.TomcatListenerAdder
      This TomcatContextCustomizer adds listeners to the servlet-context in a non-programmatic way, so they aren't affected by the restrictions for programmatically registered listeners of Section 4.4 of the Servlet Specification.
      static class  WebFragmentRegistrationBean.UndertowListenerAdder
      This UndertowDeploymentInfoCustomizer adds listeners to the servlet-context in a non-programmatic way, so they aren't affected by the restrictions for programmatically registered listeners of Section 4.4 of the Servlet Specification.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void customize​(org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory factory)  
      java.util.Map<java.lang.String,​java.lang.String> getContextParams()  
      java.util.List<org.springframework.boot.web.server.ErrorPage> getErrorPages()  
      java.util.List<java.lang.Class<? extends java.util.EventListener>> getListeners()  
      void setContextParams​(java.util.Map<java.lang.String,​java.lang.String> contextParams)  
      void setErrorPages​(java.util.List<org.springframework.boot.web.server.ErrorPage> errorPages)  
      void setListeners​(java.util.List<java.lang.Class<? extends java.util.EventListener>> listeners)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebFragmentRegistrationBean

        public WebFragmentRegistrationBean()
    • Method Detail

      • customize

        public void customize​(org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory factory)
        Specified by:
        customize in interface org.springframework.boot.web.server.WebServerFactoryCustomizer<org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory>
      • getListeners

        public java.util.List<java.lang.Class<? extends java.util.EventListener>> getListeners()
      • getErrorPages

        public java.util.List<org.springframework.boot.web.server.ErrorPage> getErrorPages()
      • getContextParams

        public java.util.Map<java.lang.String,​java.lang.String> getContextParams()
      • setListeners

        public void setListeners​(java.util.List<java.lang.Class<? extends java.util.EventListener>> listeners)
      • setErrorPages

        public void setErrorPages​(java.util.List<org.springframework.boot.web.server.ErrorPage> errorPages)
      • setContextParams

        public void setContextParams​(java.util.Map<java.lang.String,​java.lang.String> contextParams)