org.springframework.mock.web

Class MockServletConfig

  • java.lang.Object
    • org.springframework.mock.web.MockServletConfig
  • All Implemented Interfaces:
    ServletConfig


    public class MockServletConfig
    extends java.lang.Object
    implements ServletConfig
    Mock implementation of the ServletConfig interface.
    Since:
    1.0.2
    Author:
    Rod Johnson, Juergen Hoeller
    • Constructor Detail

      • MockServletConfig

        public MockServletConfig()
        Create a new MockServletConfig with a default MockServletContext.
      • MockServletConfig

        public MockServletConfig(java.lang.String servletName)
        Create a new MockServletConfig with a default MockServletContext.
        Parameters:
        servletName - the name of the servlet
      • MockServletConfig

        public MockServletConfig(@Nullable
                                 ServletContext servletContext)
        Create a new MockServletConfig.
        Parameters:
        servletContext - the ServletContext that the servlet runs in
      • MockServletConfig

        public MockServletConfig(@Nullable
                                 ServletContext servletContext,
                                 java.lang.String servletName)
        Create a new MockServletConfig.
        Parameters:
        servletContext - the ServletContext that the servlet runs in
        servletName - the name of the servlet
    • Method Detail

      • getServletName

        public java.lang.String getServletName()
        Description copied from interface: javax.servlet.ServletConfig
        Returns the name of this servlet instance. The name may be provided via server administration, assigned in the web application deployment descriptor, or for an unregistered (and thus unnamed) servlet instance it will be the servlet's class name.
        Specified by:
        getServletName in interface ServletConfig
        Returns:
        the name of the servlet instance
      • addInitParameter

        public void addInitParameter(java.lang.String name,
                                     java.lang.String value)
      • getInitParameter

        public java.lang.String getInitParameter(java.lang.String name)
        Description copied from interface: javax.servlet.ServletConfig
        Gets the value of the initialization parameter with the given name.
        Specified by:
        getInitParameter in interface ServletConfig
        Parameters:
        name - the name of the initialization parameter whose value to get
        Returns:
        a String containing the value of the initialization parameter, or null if the initialization parameter does not exist
      • getInitParameterNames

        public java.util.Enumeration<java.lang.String> getInitParameterNames()
        Description copied from interface: javax.servlet.ServletConfig
        Returns the names of the servlet's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the servlet has no initialization parameters.
        Specified by:
        getInitParameterNames in interface ServletConfig
        Returns:
        an Enumeration of String objects containing the names of the servlet's initialization parameters