类 MockServletConfig
- java.lang.Object
- org.springframework.mock.web.MockServletConfig
- 所有已实现的接口:
ServletConfig
public class MockServletConfig extends Object implements ServletConfig
Mock implementation of theServletConfig
interface.- 从以下版本开始:
- 1.0.2
- 作者:
- Rod Johnson, Juergen Hoeller
构造器概要
构造器 构造器 说明 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addInitParameter(String name, String value)
String
getInitParameter(String name)
Gets the value of the initialization parameter with the given name.Enumeration<String>
getInitParameterNames()
Returns the names of the servlet's initialization parameters as anEnumeration
ofString
objects, or an emptyEnumeration
if the servlet has no initialization parameters.ServletContext
getServletContext()
Returns a reference to theServletContext
in which the caller is executing.String
getServletName()
Returns the name of this servlet instance.
构造器详细资料
MockServletConfig
public MockServletConfig()
Create a new MockServletConfig with a defaultMockServletContext
.
MockServletConfig
public MockServletConfig(String servletName)
Create a new MockServletConfig with a defaultMockServletContext
.- 参数:
servletName
- the name of the servlet
MockServletConfig
public MockServletConfig(@Nullable ServletContext servletContext)
Create a new MockServletConfig.- 参数:
servletContext
- the ServletContext that the servlet runs in
MockServletConfig
public MockServletConfig(@Nullable ServletContext servletContext, String servletName)
Create a new MockServletConfig.- 参数:
servletContext
- the ServletContext that the servlet runs inservletName
- the name of the servlet
方法详细资料
getServletName
public String getServletName()
从接口复制的说明: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.- 指定者:
getServletName
在接口中ServletConfig
- 返回:
- the name of the servlet instance
getServletContext
public ServletContext getServletContext()
从接口复制的说明:javax.servlet.ServletConfig
Returns a reference to theServletContext
in which the caller is executing.- 指定者:
getServletContext
在接口中ServletConfig
- 返回:
- a
ServletContext
object, used by the caller to interact with its servlet container - 另请参阅:
ServletContext
addInitParameter
public void addInitParameter(String name, String value)
getInitParameter
public String getInitParameter(String name)
从接口复制的说明:javax.servlet.ServletConfig
Gets the value of the initialization parameter with the given name.