RFR: 8276559: (httpclient) Consider adding an HttpRequest.Builder.HEAD method to build a HEAD request.
Jaikiran Pai
jpai at openjdk.java.net
Thu Nov 11 12:13:44 UTC 2021
Can I please get a review for this change which implements the enhancement noted in https://bugs.openjdk.java.net/browse/JDK-8276559?
The commit in this PR introduces a new `HEAD()` method on the `HttpRequest.Builder` interface. Given that this is a public interface on a public class of a public module, I decided to add this new method as a `default` method to prevent any potential breakages of any non-JDK implementations of this interface. The internal `jdk.internal.net.http.HttpRequestBuilderImpl` which implements this interface, overrides this default implementation to use an implementation of its own.
Existing tests have been updated to include coverage for this new method.
P.S: Slightly unrelated question - is it intentional that the `Builder` interface specifies the visibility modifiers on the interface methods. For example: `public abstract Builder timeout(Duration duration);`, `public Builder headers(String... headers);` and so on?
-------------
Commit messages:
- 8276559: (httpclient) Consider adding an HttpRequest.Builder.HEAD method to build a HEAD request.
Changes: https://git.openjdk.java.net/jdk/pull/6348/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6348&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8276559
Stats: 31 lines in 5 files changed: 27 ins; 0 del; 4 mod
Patch: https://git.openjdk.java.net/jdk/pull/6348.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6348/head:pull/6348
PR: https://git.openjdk.java.net/jdk/pull/6348
More information about the net-dev
mailing list