com.meterware.servletunit
Interface InvocationContext
public
interface
InvocationContext
An interface which represents the invocation of a servlet.
Author: Russell Gold
Method Summary |
Filter | getFilter()
Returns the current active filter object. |
FilterChain | getFilterChain()
Returns the current filter chain. |
FrameSelector | getFrame()
Returns the target frame for the original request. |
HttpServletRequest | getRequest()
Returns the request to be processed by the servlet or filter.
|
HttpServletResponse | getResponse()
Returns the response which the servlet or filter should modify during its operation.
|
Servlet | getServlet()
Returns the selected servlet, initialized to provide access to sessions
and servlet context information. |
WebResponse | getServletResponse()
Returns the final response from the servlet. |
boolean | isFilterActive()
Returns true if the current context is a filter, rather than a servlet. |
void | popRequest()
Removes the top request dispatcher or filter from this context. |
void | pushFilter(ServletRequest request, ServletResponse response)
Pushes the current filter onto the execution stack and switches to the next filter or the selected servlet.
|
void | pushForwardRequest(RequestDispatcher rd, HttpServletRequest request, HttpServletResponse response)
Adds a request dispatcher to this context to simulate a forward request. |
void | pushIncludeRequest(RequestDispatcher rd, HttpServletRequest request, HttpServletResponse response)
Adds a request dispatcher to this context to simulate an include request. |
void | service()
Invokes the current servlet or filter. |
public Filter getFilter()
Returns the current active filter object. Only valid to call if
InvocationContext returns true.
Since: 1.6
public FilterChain getFilterChain()
Returns the current filter chain. Only valid to call if
InvocationContext returns true.
Since: 1.6
Returns the target frame for the original request.
Since: 1.6
public HttpServletRequest getRequest()
Returns the request to be processed by the servlet or filter.
public HttpServletResponse getResponse()
Returns the response which the servlet or filter should modify during its operation.
public Servlet getServlet()
Returns the selected servlet, initialized to provide access to sessions
and servlet context information. Only valid to call if
InvocationContext returns false.
Returns the final response from the servlet. Note that this method should
only be invoked after all processing has been done to the servlet response.
public boolean isFilterActive()
Returns true if the current context is a filter, rather than a servlet.
Since: 1.6
public void popRequest()
Removes the top request dispatcher or filter from this context.
public void pushFilter(ServletRequest request, ServletResponse response)
Pushes the current filter onto the execution stack and switches to the next filter or the selected servlet.
This can be used to simulate the effect of the
javax.servlet.FilterChain#doFilter doFilter
call.
Note: this method specifies ServletRequest and ServletResponse because those are the
types passed to Filter#doFilter; however, HttpUnit requires the objects to implement
HttpServletRequest and HttpServletResponse because they will eventually be passed to an
javax.servlet.http.HttpServlet.
Parameters: request the request to pass to the next filter. May be a wrapper. response the response object to pass to the next filter. May be a wrapper.
Since: 1.6
public void pushForwardRequest(RequestDispatcher rd, HttpServletRequest request, HttpServletResponse response)
Adds a request dispatcher to this context to simulate a forward request.
public void pushIncludeRequest(RequestDispatcher rd, HttpServletRequest request, HttpServletResponse response)
Adds a request dispatcher to this context to simulate an include request.
public void service()
Invokes the current servlet or filter.
Since: 1.6