public class MockFilterChain
extends java.lang.Object
implements javax.servlet.FilterChain
FilterChain
.Constructor and Description |
---|
MockFilterChain() |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(java.lang.Class filterClass)
Adds a filter to the chain.
|
void |
addFilter(javax.servlet.Filter filter)
Adds a filter to the chain.
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
javax.servlet.ServletRequest |
getLastRequest()
Returns the last request, usually the request that was
used to call the final servlet.
|
javax.servlet.ServletResponse |
getLastResponse()
Returns the last response, usually the response that was
used to call the final servlet.
|
java.util.List |
getRequestList()
Returns the list of all request objects used to call
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) when iterating through the chain. |
java.util.List |
getResponseList()
Returns the list of all response objects used to call
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) when iterating through the chain. |
void |
release()
Clears all filters and sets the current servlet to
null . |
void |
reset()
Resets the internal iterator of this chain.
|
void |
setServlet(javax.servlet.Servlet servlet)
Sets the servlet that is called at the end of the chain.
|
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.io.IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.FilterChain
java.io.IOException
javax.servlet.ServletException
public void reset()
public void addFilter(javax.servlet.Filter filter)
filter
- the filterpublic void addFilter(java.lang.Class filterClass)
javax.servlet.Filter
.filterClass
- the filter classjava.lang.IllegalArgumentException
- if the specified class does not implement
javax.servlet.Filter
public void setServlet(javax.servlet.Servlet servlet)
servlet
- the servletpublic void release()
null
.public java.util.List getRequestList()
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
when iterating through the chain.public java.util.List getResponseList()
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
when iterating through the chain.public javax.servlet.ServletRequest getLastRequest()
null
if no request is specified, e.g. if the chain wasn't called.
Otherwise returns the last entry of the list returned by
getRequestList()
.public javax.servlet.ServletResponse getLastResponse()
null
if no response is specified, e.g. if the chain wasn't called.
Otherwise returns the last entry of the list returned by
getResponseList()
.Copyright © 2003-2018. All Rights Reserved.