Re: RFR: 8265123: Add static factory methods to com.sun.net.httpserver.Filter [v4]

2021-04-28 Thread Michael McMahon
On Wed, 28 Apr 2021 11:29:18 GMT, Julia Boes  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 filterImpl) {}`
>> `public static Filter afterResponse(String description, 
>> Consumer filterImpl) {}`
>
> Julia Boes has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   update specs and small fix in test

Changes requested by michaelm (Reviewer).

src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java line 149:

> 147:  * operation.
> 148:  *
> 149:  * The {@link #description() description} describes the returned 
> filter.

Maybe, delete the first sentence here. I don't think it adds much value. Then 
the @param for description could say: The string to be returned from {@link 
#description()}

-

PR: https://git.openjdk.java.net/jdk/pull/3468


Re: RFR: 8265123: Add static factory methods to com.sun.net.httpserver.Filter [v4]

2021-04-28 Thread Daniel Fuchs
On Wed, 28 Apr 2021 11:29:18 GMT, Julia Boes  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 filterImpl) {}`
>> `public static Filter afterResponse(String description, 
>> Consumer 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:  *  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:  *  Example of adding a sequence of afterHandler filters to a 
> context:
> 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


Re: RFR: 8265123: Add static factory methods to com.sun.net.httpserver.Filter [v4]

2021-04-28 Thread Julia Boes
> 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 filterImpl) {}`
> `public static Filter afterResponse(String description, 
> Consumer filterImpl) {}`

Julia Boes has updated the pull request incrementally with one additional 
commit since the last revision:

  update specs and small fix in test

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3468/files
  - new: https://git.openjdk.java.net/jdk/pull/3468/files/823bce14..8751f654

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3468=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3468=02-03

  Stats: 54 lines in 2 files changed: 5 ins; 9 del; 40 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3468.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3468/head:pull/3468

PR: https://git.openjdk.java.net/jdk/pull/3468


Re: RFR: 8265123: Add static factory methods to com.sun.net.httpserver.Filter [v4]

2021-04-28 Thread Chris Hegarty
On Wed, 28 Apr 2021 11:26:18 GMT, Julia Boes  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 filterImpl) {}`
>> `public static Filter afterResponse(String description, 
>> Consumer filterImpl) {}`
>
> Julia Boes has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   update specs and small fix in test

Marked as reviewed by chegar (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/3468