RFR: 8272758: Improve HttpServer to avoid partial file name matches while mapping request path to context path [v2]
Volkan Yazici
vyazici at openjdk.org
Mon Feb 2 20:29:50 UTC 2026
On Thu, 29 Jan 2026 14:54:35 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add property to switch between prefix matching schemes
>
> test/jdk/com/sun/net/httpserver/ContextPathMatcherPathPrefixTest.java line 72:
>
>> 70: * ${test.main.class}
>> 71: */
>> 72:
>
> Could we simply have another test comment to test with `-Dsun.net.httpserver.pathMatcher=stringPrefix` instead of having a separate test class?
I don't think we can have that _simply_. To test string-prefix matching in the same file with path-prefix matching, I need to add a _"If we're expecting path-prefix matching, do this; otherwise, do this"_ branching to every single `@Test` method, and this was the very reason I split the tests into two files and reused the boilerplate (e.g., the `Infra` class) between the two. Nevertheless, to further simplify `ContextPathMatcherStringPrefixTest`, I make it extend from `ContextPathMatcherPathPrefixTest` in e55e6050466. If you have another suggestion, I'm all ears.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29264#discussion_r2756028366
More information about the net-dev
mailing list