RFR: 7105350: HttpExchange's attributes are the same as HttpContext's attributes [v2]
Michael McMahon
michaelm at openjdk.org
Wed Oct 8 10:14:17 UTC 2025
On Wed, 8 Oct 2025 02:29:54 GMT, Josiah Noel <duke at openjdk.org> wrote:
>> src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java line 65:
>>
>>> 63: private static final boolean perExchangeAttributes =
>>> 64: !System.getProperty("jdk.httpserver.attributes", "")
>>> 65: .equals("context");
>>
>> The property will have to be documented somewhere such as the jdk.httpserver module-info. But, I'm wondering if fairly obscure properties like this might be better off "buried" in the net.properties config file. I think there's a case for putting all such "compatibility" flags somewhere out of the way like that. If we were to do that, you would need to access the property using `sun.net.NetProperties`.
>>
>> Any other views on this?
>
> I can switch to `sun.net.NetProperties` if you so desire.
Yeah, I think we should put the property in `net.properties` something like this:
# Prior to JDK 26, the HttpExchange attribute map was shared with the enclosing HttpContext.
# Since JDK 26, by default, exchange attributes are per-exchange and the context attributes must
# be accessed by calling getHttpContext().getAttributes(). Uncomment this property to
# restore the pre JDK 26 behavior.
#
# jdk.httpserver.attributes=context
Then I think we should add a sentence at the end of the jdk.httpserver module-info to say that additional
system/networking properties may be defined in `net.properties`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27652#discussion_r2413328557
More information about the net-dev
mailing list