On Wed, 28 Apr 2021 11:29:18 GMT, Julia Boes <jb...@openjdk.org> wrote:
>> Add two static factory methods to com.sun.net.httpserver.Filter that >> facilitate the creation of pre- and post-processing Filters: >> >> `public static Filter beforeResponse(String description, >> Consumer<HttpExchange> filterImpl) {}` >> `public static Filter afterResponse(String description, >> Consumer<HttpExchange> filterImpl) {}` > > Julia Boes has updated the pull request incrementally with one additional > commit since the last revision: > > update specs and small fix in test src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java line 164: > 162: * since this is commonly done by the exchange handler. > 163: * > 164: * <p> Example of adding the Foo response header to all responses: Maybe `the {@code "Foo"}` ? Or `the {@code "Foo: Bar"}`? src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java line 212: > 210: * exchange or {@linkplain HttpExchange#sendResponseHeaders(int, > long) send the response headers}. > 211: * Doing so is likely to fail, since this is commonly done by the > exchange > 212: * handler. maybe `... since the request is expected to have already been handled before the operation is executed`? src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java line 222: > 220: * <p> Example of adding a sequence of afterHandler filters to a > context:<br> > 221: * The order in which the filters are invoked is reverse to the > order in > 222: * which they are added to the context's filter-list. May need to be a bit more precise. The filters are invoked in the order they are added, but their operations are invoked in the reverse order. I'd suggest: * The order in which the filter's operations are invoked is reverse to the order in * which the filters are added to the context's filter-list. ------------- PR: https://git.openjdk.java.net/jdk/pull/3468