java.lang.Object
com.sun.net.httpserver.Filter
A filter used to pre- and post-process incoming requests. Pre-processing occurs
before the application's exchange handler is invoked, and post-processing
occurs after the exchange handler returns. Filters are organised in chains,
and are associated with
HttpContext instances.
Each Filter in the chain, invokes the next filter within its own
doFilter(HttpExchange, Chain) implementation. The final Filter
in the chain invokes the applications exchange handler.
- Since:
- 1.6
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilteradaptRequest(String description, UnaryOperator<Request> requestOperator) Returns a pre-processing Filter that inspects and possibly adapts the request state.static FilterafterHandler(String description, Consumer<HttpExchange> operation) Returns a post-processingFilterwith the given description and operation.static FilterbeforeHandler(String description, Consumer<HttpExchange> operation) Returns a pre-processingFilterwith the given description and operation.abstract StringReturns a short description of thisFilter.abstract voiddoFilter(HttpExchange exchange, Filter.Chain chain) Asks this filter to pre/post-process the given exchange.