org.springframework.boot.context.embedded

Class ServletRegistrationBean

    • Constructor Detail

      • ServletRegistrationBean

        public ServletRegistrationBean(javax.servlet.Servlet servlet,
                               String... urlMappings)
        Create a new ServletRegistrationBean instance with the specified Servlet and URL mappings.
        Parameters:
        servlet - the servlet being mapped
        urlMappings - the URLs being mapped
    • Method Detail

      • getServlet

        protected javax.servlet.Servlet getServlet()
        Returns the servlet being registered.
        Returns:
        the sevlet
      • setServlet

        public void setServlet(javax.servlet.Servlet servlet)
        Sets the servlet to be registered.
        Parameters:
        servlet - the servlet
      • setUrlMappings

        public void setUrlMappings(Collection<String> urlMappings)
        Set the URL mappings for the servlet. If not specified the mapping will default to '/'. This will replace any previously specified mappings.
        Parameters:
        urlMappings - the mappings to set
        See Also:
        addUrlMappings(String...)
      • getUrlMappings

        public Collection<String> getUrlMappings()
        Return a mutable collection of the URL mappings for the servlet.
        Returns:
        the urlMappings
      • addUrlMappings

        public void addUrlMappings(String... urlMappings)
        Add URL mappings for the servlet.
        Parameters:
        urlMappings - the mappings to add
        See Also:
        setUrlMappings(Collection)
      • setLoadOnStartup

        public void setLoadOnStartup(int loadOnStartup)
        Sets the loadOnStartup priority. See ServletRegistration.Dynamic#setLoadOnStartup for details.
        Parameters:
        loadOnStartup - if load on startup is enabled
      • setMultipartConfig

        public void setMultipartConfig(javax.servlet.MultipartConfigElement multipartConfig)
        Set the the multi-part configuration.
        Parameters:
        multipartConfig - the muti-part configuration to set or null
      • getMultipartConfig

        public javax.servlet.MultipartConfigElement getMultipartConfig()
        Returns the multi-part configuration to be applied or null.
        Returns:
        the multipart config
      • getServletName

        public String getServletName()
        Returns the servlet name that will be registered.
        Returns:
        the servlet name
      • onStartup

        public void onStartup(javax.servlet.ServletContext servletContext)
                       throws javax.servlet.ServletException
        Description copied from interface: ServletContextInitializer
        Configure the given ServletContext with any servlets, filters, listeners context-params and attributes necessary for initialization.
        Parameters:
        servletContext - the ServletContext to initialize
        Throws:
        javax.servlet.ServletException - if any call against the given ServletContext throws a ServletException
      • configure

        protected void configure(javax.servlet.ServletRegistration.Dynamic registration)
        Configure registration settings. Subclasses can override this method to perform additional configuration if required.
        Parameters:
        registration - the registration

Copyright © 2015 Pivotal Software, Inc.. All rights reserved.