Package org.springframework.mock.web
Class MockServletConfig
- java.lang.Object
- org.springframework.mock.web.MockServletConfig
- All Implemented Interfaces:
ServletConfig
public class MockServletConfig extends Object implements ServletConfig
Mock implementation of theServletConfig
interface.Used for testing the web framework; typically not necessary for testing application controllers.
- Since:
- 1.0.2
- Author:
- Rod Johnson, Juergen Hoeller
Constructor Summary
Constructors Constructor Description MockServletConfig()
Create a new MockServletConfig with a defaultMockServletContext
.MockServletConfig(String servletName)
Create a new MockServletConfig with a defaultMockServletContext
.MockServletConfig(ServletContext servletContext)
Create a new MockServletConfig.MockServletConfig(ServletContext servletContext, String servletName)
Create a new MockServletConfig.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInitParameter(String name, String value)
String
getInitParameter(String name)
Enumeration<String>
getInitParameterNames()
ServletContext
getServletContext()
String
getServletName()
Constructor Detail
MockServletConfig
public MockServletConfig()
Create a new MockServletConfig with a defaultMockServletContext
.
MockServletConfig
public MockServletConfig(String servletName)
Create a new MockServletConfig with a defaultMockServletContext
.- Parameters:
servletName
- the name of the servlet
MockServletConfig
public MockServletConfig(ServletContext servletContext)
Create a new MockServletConfig.- Parameters:
servletContext
- the ServletContext that the servlet runs in
MockServletConfig
public MockServletConfig(ServletContext servletContext, String servletName)
Create a new MockServletConfig.- Parameters:
servletContext
- the ServletContext that the servlet runs inservletName
- the name of the servlet
Method Detail
getServletName
public String getServletName()
- Specified by:
getServletName
in interfaceServletConfig
getServletContext
public ServletContext getServletContext()
- Specified by:
getServletContext
in interfaceServletConfig
addInitParameter
public void addInitParameter(String name, String value)
getInitParameter
public String getInitParameter(String name)
- Specified by:
getInitParameter
in interfaceServletConfig
getInitParameterNames
public Enumeration<String> getInitParameterNames()
- Specified by:
getInitParameterNames
in interfaceServletConfig