public class CookieFilter extends Object implements Filter
DefaultCookieSpec
.
It might come in handy when more than just the SessionFilter
and browser-like cookie matching is needed.
For example:
CookieFilter cookieFilter = new CookieFilter(); given(). filter(cookieFilter). expect(). statusCode(200). when(). get("/x"); given(). cookie("foo", "bar"). filter(cookieFilter). // Reuse the same cookie filter // if "foo" is stored in cookieFilter it won't be applied because it's already applied explicitly expect(). statusCode(200). when(). get("/y");
Constructor and Description |
---|
CookieFilter() |
Modifier and Type | Method and Description |
---|---|
Response |
filter(FilterableRequestSpecification requestSpec,
FilterableResponseSpecification responseSpec,
FilterContext ctx)
Filter the incoming request and response specifications and outgoing response.
|
public Response filter(FilterableRequestSpecification requestSpec, FilterableResponseSpecification responseSpec, FilterContext ctx)
Filter
FilterContext.next(FilterableRequestSpecification, FilterableResponseSpecification)
when you're done otherwise the request will not be delivered.
It's of course possible to abort the filter chain execution by returning a Response
directly.filter
in interface Filter
requestSpec
- The incoming request specresponseSpec
- The incoming response specctx
- The filter context. You need to call FilterContext.next(FilterableRequestSpecification, FilterableResponseSpecification)
when you're done otherwise the request will not be delivered.Copyright © 2010–2019. All rights reserved.