org.springframework.mock.web
Class MockServletConfig

java.lang.Object
  extended by org.springframework.mock.web.MockServletConfig

public class MockServletConfig
extends java.lang.Object

Mock implementation of the javax.servlet.ServletConfig interface.

Used for testing the web framework; typically not necessary for testing application controllers.

Since:
1.0.2
Author:
Rod Johnson, Juergen Hoeller

Field Summary
private  java.util.Map<java.lang.String,java.lang.String> initParameters
           
private  ServletContext servletContext
           
private  java.lang.String servletName
           
 
Constructor Summary
MockServletConfig()
          Create a new MockServletConfig with a default MockServletContext.
MockServletConfig(ServletContext servletContext)
          Create a new MockServletConfig.
MockServletConfig(ServletContext servletContext, java.lang.String servletName)
          Create a new MockServletConfig.
MockServletConfig(java.lang.String servletName)
          Create a new MockServletConfig with a default MockServletContext.
 
Method Summary
 void addInitParameter(java.lang.String name, java.lang.String value)
           
 java.lang.String getInitParameter(java.lang.String name)
           
 java.util.Enumeration<java.lang.String> getInitParameterNames()
           
 ServletContext getServletContext()
           
 java.lang.String getServletName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletContext

private final ServletContext servletContext

servletName

private final java.lang.String servletName

initParameters

private final java.util.Map<java.lang.String,java.lang.String> initParameters
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(ServletContext servletContext)
Create a new MockServletConfig.

Parameters:
servletContext - the ServletContext that the servlet runs in

MockServletConfig

public MockServletConfig(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()

getServletContext

public ServletContext getServletContext()

addInitParameter

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

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)

getInitParameterNames

public java.util.Enumeration<java.lang.String> getInitParameterNames()