RFR: 7105350: HttpExchange's attributes are the same as HttpContext's attributes [v10]

Daniel Fuchs dfuchs at openjdk.org
Thu Oct 16 15:08:24 UTC 2025


On Wed, 15 Oct 2025 17:46:56 GMT, Josiah Noel <duke at openjdk.org> wrote:

>> Now ExchangeImpl will default to having a separate attribute map for the request duration.
>
> Josiah Noel has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update module-info.java

Still a couple of issues to resolve - but we should be able to start with the CSR process now.

src/jdk.httpserver/share/classes/module-info.java line 112:

> 110:  * be accessed by calling {@link HttpExchange#getHttpContext() getHttpContext()}{@link
> 111:  * HttpContext#getAttributes() .getAttributes()}. <br>
> 112:  * A new system property, {@systemProperty jdk.httpserver.attributes}</b> (default value: {@code ""})

Suggestion:

 * A new system property, <b>{@systemProperty jdk.httpserver.attributes}</b> (default value: {@code ""})


`</b>` without `<b>` is making the doc build fail

test/jdk/com/sun/net/httpserver/ExchangeAttributeTest.java line 74:

> 72:         var handler = new AttribHandler();
> 73:         var server = HttpServer.create(new InetSocketAddress(LOOPBACK_ADDR,0), 10);
> 74:         server.createContext("/", handler).getAttributes().put("attr", "context-val");

So this tests the new behaviour by verifying that a context attribute is no longer visible from the exchange attributes. I believe we also need to test the opposite: an exchange attribute is not visible from the context. Also we want to verify that setting the new system property actually revert to the old behavior.

-------------

Changes requested by dfuchs (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27652#pullrequestreview-3345415766
PR Review Comment: https://git.openjdk.org/jdk/pull/27652#discussion_r2436367685
PR Review Comment: https://git.openjdk.org/jdk/pull/27652#discussion_r2436390889


More information about the net-dev mailing list