类 ServletRegistrationBean

    • 构造器详细资料

      • ServletRegistrationBean

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

        public ServletRegistrationBean​(javax.servlet.Servlet servlet,
                                       boolean alwaysMapUrl,
                                       String... urlMappings)
        Create a new ServletRegistrationBean instance with the specified Servlet and URL mappings.
        参数:
        servlet - the servlet being mapped
        alwaysMapUrl - if omitted URL mappings should be replaced with '/*'
        urlMappings - the URLs being mapped
    • 方法详细资料

      • getServlet

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

        public void setServlet​(javax.servlet.Servlet servlet)
        Sets the servlet to be registered.
        参数:
        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.
        参数:
        urlMappings - the mappings to set
        另请参阅:
        addUrlMappings(String...)
      • setLoadOnStartup

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

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

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

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

        public void onStartup​(javax.servlet.ServletContext servletContext)
                       throws javax.servlet.ServletException
        从接口复制的说明: ServletContextInitializer
        Configure the given ServletContext with any servlets, filters, listeners context-params and attributes necessary for initialization.
        参数:
        servletContext - the ServletContext to initialize
        抛出:
        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.
        参数:
        registration - the registration