Package org.springframework.mock.web
Class MockRequestDispatcher
- java.lang.Object
 - org.springframework.mock.web.MockRequestDispatcher
 
- All Implemented Interfaces:
 RequestDispatcher
public class MockRequestDispatcher extends Object implements RequestDispatcher
Mock implementation of theRequestDispatcherinterface.Used for testing the web framework; typically not necessary for testing application controllers.
- Since:
 - 1.0.2
 - Author:
 - Rod Johnson, Juergen Hoeller, Sam Brannen
 
Field Summary
Fields inherited from interface javax.servlet.RequestDispatcher
ERROR_EXCEPTION, ERROR_EXCEPTION_TYPE, ERROR_MESSAGE, ERROR_REQUEST_URI, ERROR_SERVLET_NAME, ERROR_STATUS_CODE, FORWARD_CONTEXT_PATH, FORWARD_PATH_INFO, FORWARD_QUERY_STRING, FORWARD_REQUEST_URI, FORWARD_SERVLET_PATH, INCLUDE_CONTEXT_PATH, INCLUDE_PATH_INFO, INCLUDE_QUERY_STRING, INCLUDE_REQUEST_URI, INCLUDE_SERVLET_PATH
Constructor Summary
Constructors Constructor Description MockRequestDispatcher(String resource)Create a new MockRequestDispatcher for the given resource.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforward(ServletRequest request, ServletResponse response)protected MockHttpServletResponsegetMockHttpServletResponse(ServletResponse response)Obtain the underlyingMockHttpServletResponse, unwrappingHttpServletResponseWrapperdecorators if necessary.voidinclude(ServletRequest request, ServletResponse response)
Constructor Detail
MockRequestDispatcher
public MockRequestDispatcher(String resource)
Create a new MockRequestDispatcher for the given resource.- Parameters:
 resource- the server resource to dispatch to, located at a particular path or given by a particular name
Method Detail
forward
public void forward(ServletRequest request, ServletResponse response)
- Specified by:
 forwardin interfaceRequestDispatcher
include
public void include(ServletRequest request, ServletResponse response)
- Specified by:
 includein interfaceRequestDispatcher
getMockHttpServletResponse
protected MockHttpServletResponse getMockHttpServletResponse(ServletResponse response)
Obtain the underlyingMockHttpServletResponse, unwrappingHttpServletResponseWrapperdecorators if necessary.