Package org.openqa.selenium.remote.http
Interface Filter
- All Superinterfaces:
Function<HttpHandler,
HttpHandler>
- All Known Implementing Classes:
AddSecretFilter
,AddSeleniumUserAgent
,AddWebDriverSpecHeaders
,BasicAuthenticationFilter
,CheckContentTypeHeader
,CheckOriginHeader
,DumpHttpExchangeFilter
,EnsureSpecCompliantHeaders
,EnsureSpecCompliantResponseHeaders
,ErrorFilter
,RequiresSecretFilter
,RetryRequest
,SpanDecorator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Can be wrapped around an
HttpHandler
in order to either modify incoming HttpRequest
s or outgoing HttpResponse
s using the well-known "Filter" pattern. This is
very similar to the Servlet spec's javax.servlet.Filter
, but takes advantage of lambdas:
Filter filter = next -> {
return req -> {
req.addHeader("cheese", "brie");
HttpResponse res = next.apply(req);
res.addHeader("vegetable", "peas");
return res;
};
}
Because each filter returns an HttpHandler
, it's easy to do processing before, or
after each request, as well as short-circuit things if necessary.
-
Method Summary
Modifier and TypeMethodDescriptiondefault HttpHandler
andFinally
(HttpHandler end) default Routable
andFinally
(Routable end) default Filter
-
Method Details
-
andThen
-
andFinally
-
andFinally
-