org.apache.click.servlet
Class MockRequestDispatcher

java.lang.Object
  extended by org.apache.click.servlet.MockRequestDispatcher
All Implemented Interfaces:
RequestDispatcher

public class MockRequestDispatcher
extends Object
implements RequestDispatcher

Mock implementation of RequestDispatcher.

This RequestDispatcher sets the resource path on the request when forward(ServletRequest, ServletResponse) or include(ServletRequest, ServletResponse) is called.

The resourcePath can later be retrieved by calling MockRequest.getForward() or MockRequest.getIncludes().


Constructor Summary
MockRequestDispatcher(String resourcePath)
          Constructs a new RequestDispatcher instance for the specified resourcePath.
 
Method Summary
 void forward(ServletRequest request, ServletResponse response)
          This method stores the dispatcher's resourcePath on the request.
 void include(ServletRequest request, ServletResponse response)
          This method stores the dispatcher's resourcePath on the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockRequestDispatcher

public MockRequestDispatcher(String resourcePath)
Constructs a new RequestDispatcher instance for the specified resourcePath.

Parameters:
resourcePath - the resource path to dispatch to
Method Detail

forward

public void forward(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    IOException
This method stores the dispatcher's resourcePath on the request.

The resourcePath can later be retrieved by calling MockRequest.getForward()

Specified by:
forward in interface RequestDispatcher
Parameters:
request - the servlet request
response - the servlet response
Throws:
ServletException - if the response was already committed
IOException - if the target resource throws this exception

include

public void include(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    IOException
This method stores the dispatcher's resourcePath on the request.

The resourcePath can be retrieved by calling MockRequest.getIncludes()

Specified by:
include in interface RequestDispatcher
Parameters:
request - the servlet request
response - the servlet response
Throws:
ServletException - if the response was already committed
IOException - if the target resource throws this exception