public abstract class Filter extends Object
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
Filter in the chain, invokes the next filter within its own
doFilter(HttpExchange, Chain) implementation. The final
in the chain invokes the applications exchange handler.
Nested Class Summary
Filter()Constructor for subclasses to call.
Filterprotected Filter()Constructor for subclasses to call.
doFilterAsks this filter to pre/post-process the given exchange. The filter can:
- Examine or modify the request headers.
- Filter the request body or the response body, by creating suitable
filter streams and calling
- Set attribute objects in the exchange, which other filters or the exchange handler can access.
- Decide to either:
- If option 1. above is taken, then when doFilter() returns all subsequent filters in the Chain have been called, and the response headers can be examined or modified.
- If option 2. above is taken, then this Filter must use the HttpExchange to send back an appropriate response.
descriptionpublic abstract String description()Returns a short description of this