This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 02e77d4f3821c6729adfed430672eaf76a7f2e37
Author: Andy Seaborne <[email protected]>
AuthorDate: Fri Mar 6 15:58:13 2026 +0000

    Use HttpEnv.getHttpClient in HttpOp, HttpRDF, AsyncHttpRDF and HttpLib
---
 .../java/org/apache/jena/http/AsyncHttpRDF.java    |  6 +--
 .../main/java/org/apache/jena/http/HttpLib.java    |  2 +-
 .../src/main/java/org/apache/jena/http/HttpOp.java | 46 +++++++++++-----------
 .../main/java/org/apache/jena/http/HttpRDF.java    | 14 +++----
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/http/AsyncHttpRDF.java 
b/jena-arq/src/main/java/org/apache/jena/http/AsyncHttpRDF.java
index e2327898ce..41bf90efa5 100644
--- a/jena-arq/src/main/java/org/apache/jena/http/AsyncHttpRDF.java
+++ b/jena-arq/src/main/java/org/apache/jena/http/AsyncHttpRDF.java
@@ -58,7 +58,7 @@ public class AsyncHttpRDF {
 
     /** Get a graph, asynchronously */
     public static CompletableFuture<Graph> asyncGetGraph(String url) {
-        return asyncGetGraph(HttpEnv.getDftHttpClient(), url);
+        return asyncGetGraph(HttpEnv.getHttpClient(url), url);
     }
 
     /** Get a graph, asynchronously */
@@ -73,7 +73,7 @@ public class AsyncHttpRDF {
 
     /** Get a dataset, asynchronously */
     public static CompletableFuture<DatasetGraph> asyncGetDatasetGraph(String 
url) {
-        return asyncGetDatasetGraph(HttpEnv.getDftHttpClient(), url);
+        return asyncGetDatasetGraph(HttpEnv.getHttpClient(url), url);
     }
 
     /** Get a dataset, asynchronously */
@@ -91,7 +91,7 @@ public class AsyncHttpRDF {
      * The dataset is updated inside a transaction.
      */
     public static CompletableFuture<Void> asyncLoadDatasetGraph(String url, 
DatasetGraph dsg) {
-        return asyncLoadDatasetGraph(HttpEnv.getDftHttpClient(), url, dsg);
+        return asyncLoadDatasetGraph(HttpEnv.getHttpClient(url), url, dsg);
     }
 
     /**
diff --git a/jena-arq/src/main/java/org/apache/jena/http/HttpLib.java 
b/jena-arq/src/main/java/org/apache/jena/http/HttpLib.java
index 7b585f9d6e..7394d97252 100644
--- a/jena-arq/src/main/java/org/apache/jena/http/HttpLib.java
+++ b/jena-arq/src/main/java/org/apache/jena/http/HttpLib.java
@@ -810,7 +810,7 @@ public class HttpLib {
         HttpRequest.Builder builder =
                 
HttpRequest.newBuilder().uri(toRequestURI(datasetURL)).method(HttpNames.METHOD_HEAD,
 BodyPublishers.noBody());
         HttpRequest request = builder.build();
-        HttpClient httpClient = HttpEnv.getDftHttpClient();
+        HttpClient httpClient = HttpEnv.getHttpClient(datasetURL);
         HttpResponse<InputStream> response = execute(httpClient, request);
         handleResponseNoBody(response);
 
diff --git a/jena-arq/src/main/java/org/apache/jena/http/HttpOp.java 
b/jena-arq/src/main/java/org/apache/jena/http/HttpOp.java
index 2697442925..d2ad2e2216 100644
--- a/jena-arq/src/main/java/org/apache/jena/http/HttpOp.java
+++ b/jena-arq/src/main/java/org/apache/jena/http/HttpOp.java
@@ -80,7 +80,7 @@ public class HttpOp {
 
     /** Perform an HTTP and return the body as a string, Return null for a 
"404 Not Found". */
     public static String httpGetString(String url) {
-        return httpGetString(HttpEnv.getDftHttpClient(), url, null);
+        return httpGetString(HttpEnv.getHttpClient(url), url, null);
     }
 
     /**
@@ -89,7 +89,7 @@ public class HttpOp {
      * unlike {@link #httpGetString(String)}.
      */
     public static String httpGetStringEx(String url) throws HttpException {
-        return httpGetString(HttpEnv.getDftHttpClient(), url, null, false);
+        return httpGetString(HttpEnv.getHttpClient(url), url, null, false);
     }
 
     /**
@@ -99,14 +99,14 @@ public class HttpOp {
      */
     public static void httpGetDiscard(String url) throws HttpException {
         HttpRequest httpRequest = newGetRequest(url, setAcceptHeader("*/*"));
-        HttpClient httpClient = HttpEnv.getDftHttpClient();
+        HttpClient httpClient = HttpEnv.getHttpClient(url);
         HttpResponse<InputStream> response = execute(httpClient, httpRequest);
         HttpLib.handleResponseNoBody(response);
     }
 
     /** Perform an HTTP and return the body as a string, Return null for a 
"404 Not Found". */
     public static String httpGetString(String url, String acceptHeader) {
-        return httpGetString(HttpEnv.getDftHttpClient(), url, acceptHeader);
+        return httpGetString(HttpEnv.getHttpClient(url), url, acceptHeader);
     }
 
     /** Perform an HTTP and return the body as a string. Return null for a 
"404 Not Found". */
@@ -137,7 +137,7 @@ public class HttpOp {
      * Return null for a "404 Not Found".
      */
     public static String httpPostRtnString(String url) {
-        return httpPostRtnString(HttpEnv.getDftHttpClient(), url);
+        return httpPostRtnString(HttpEnv.getHttpClient(url), url);
     }
 
     /**
@@ -163,12 +163,12 @@ public class HttpOp {
 
     /** POST params as a HTML form. */
     public static void httpPostForm(String url, Params params) {
-        try ( TypedInputStream in = execPostForm(HttpEnv.getDftHttpClient(), 
url, params, null) ) {}
+        try ( TypedInputStream in = execPostForm(HttpEnv.getHttpClient(url), 
url, params, null) ) {}
     }
 
     /** POST params as a HTML form. */
     public static TypedInputStream httpPostForm(String url, Params params, 
String acceptString) {
-        return execPostForm(HttpEnv.getDftHttpClient(), url, params, 
acceptString);
+        return execPostForm(HttpEnv.getHttpClient(url), url, params, 
acceptString);
     }
 
     private static TypedInputStream execPostForm(HttpClient httpClient, String 
url, Params params, String acceptString) {
@@ -204,12 +204,12 @@ public class HttpOp {
 
     /** Perform an HTTP GET to a URL, with "Accept" header "*{@literal /}*". 
The application MUST close the InputStream. */
     public static TypedInputStream httpGet(String url) {
-        return httpGet(HttpEnv.getDftHttpClient(), url);
+        return httpGet(HttpEnv.getHttpClient(url), url);
     }
 
     /** Perform an HTTP GET to a URL. The application MUST close the 
InputStream. */
     public static TypedInputStream httpGet(String url, String acceptHeader) {
-        return httpGet(HttpEnv.getDftHttpClient(), url, acceptHeader);
+        return httpGet(HttpEnv.getHttpClient(url), url, acceptHeader);
     }
 
     /** Perform an HTTP GET to a URL. The application MUST close the 
InputStream. */
@@ -240,7 +240,7 @@ public class HttpOp {
 
     /** POST */
     public static void httpPost(String url) {
-        httpPost(HttpEnv.getDftHttpClient(), url, null, 
BodyPublishers.noBody());
+        httpPost(HttpEnv.getHttpClient(url), url, null, 
BodyPublishers.noBody());
     }
 
     /** POST
@@ -249,12 +249,12 @@ public class HttpOp {
      * @see BodyPublishers#ofString
      */
     public static void httpPost(String url, String contentType, BodyPublisher 
body) {
-        httpPost(HttpEnv.getDftHttpClient(), url, contentType, body);
+        httpPost(HttpEnv.getHttpClient(url), url, contentType, body);
     }
 
     /** POST to a URL with content=type and string. */
     public static void httpPost(String url, String contentType, String body) {
-        httpPost(HttpEnv.getDftHttpClient(), url, contentType, 
BodyPublishers.ofString(body));
+        httpPost(HttpEnv.getHttpClient(url), url, contentType, 
BodyPublishers.ofString(body));
     }
 
     /** POST
@@ -273,12 +273,12 @@ public class HttpOp {
 
     /** POST - the application MUST close the InputStream.*/
     public static TypedInputStream httpPostStream(String url) {
-        return httpPostStream(HttpEnv.getDftHttpClient(), url);
+        return httpPostStream(HttpEnv.getHttpClient(url), url);
     }
 
     /** POST - the application MUST close the InputStream.*/
     public static TypedInputStream httpPostStream(String url, String 
acceptHeader) {
-        return execPostStream(HttpEnv.getDftHttpClient(), url, acceptHeader);
+        return execPostStream(HttpEnv.getHttpClient(url), url, acceptHeader);
     }
 
     /** POST - the application MUST close the InputStream.*/
@@ -298,19 +298,19 @@ public class HttpOp {
 
     /** POST - the application MUST close the InputStream.*/
     public static TypedInputStream httpPostStream(String url, String 
contentType, BodyPublisher bodyContent) {
-        return httpPostStream(HttpEnv.getDftHttpClient(), url, contentType, 
bodyContent);
+        return httpPostStream(HttpEnv.getHttpClient(url), url, contentType, 
bodyContent);
     }
 
     /** POST - the application MUST close the InputStream.*/
     public static TypedInputStream httpPostStream(String url, String 
contentType, String bodyContent) {
-        return httpPostStream(HttpEnv.getDftHttpClient(), url, contentType, 
BodyPublishers.ofString(bodyContent));
+        return httpPostStream(HttpEnv.getHttpClient(url), url, contentType, 
BodyPublishers.ofString(bodyContent));
     }
 
     // ---- POST content, stream response
 
     /** POST - the application MUST close the InputStream.*/
     public static TypedInputStream httpPostStream(String url, String 
contentType, BodyPublisher bodyContent, String acceptHeader) {
-        return httpPostStream(HttpEnv.getDftHttpClient(), url, contentType, 
bodyContent, acceptHeader);
+        return httpPostStream(HttpEnv.getHttpClient(url), url, contentType, 
bodyContent, acceptHeader);
     }
 
     /** POST - the application MUST close the InputStream.*/
@@ -343,7 +343,7 @@ public class HttpOp {
      * @see BodyPublishers#ofString
      */
     public static void httpPut(String url, String contentType, BodyPublisher 
body) {
-        httpPut(HttpEnv.getDftHttpClient(), url, contentType, body);
+        httpPut(HttpEnv.getHttpClient(url), url, contentType, body);
     }
 
     /** PUT
@@ -361,7 +361,7 @@ public class HttpOp {
      * @see BodyPublishers#ofString
      */
     public static void httpPatch(String url, String contentType, BodyPublisher 
body) {
-        httpPatch(HttpEnv.getDftHttpClient(), url, contentType, body);
+        httpPatch(HttpEnv.getHttpClient(url), url, contentType, body);
     }
 
     /** PATCH
@@ -382,7 +382,7 @@ public class HttpOp {
 
     /** DELETE */
     public static void httpDelete(String url) {
-        httpDelete(HttpEnv.getDftHttpClient(), url);
+        httpDelete(HttpEnv.getHttpClient(url), url);
     }
 
     /** DELETE */
@@ -401,7 +401,7 @@ public class HttpOp {
 
     /** OPTIONS. Returns the HTTP response "Allow" field string. */
     public static String httpOptions(String url) {
-        return httpOptions(HttpEnv.getDftHttpClient(), url);
+        return httpOptions(HttpEnv.getHttpClient(url), url);
     }
 
     /** OPTIONS. Returns the HTTP response "Allow" field string. */
@@ -424,7 +424,7 @@ public class HttpOp {
      * Throw {@link HttpException} for any response that is not 2xx.
      */
     public static String httpHead(String url) {
-        return httpHead(HttpEnv.getDftHttpClient(), url);
+        return httpHead(HttpEnv.getHttpClient(url), url);
     }
 
     /**
@@ -442,7 +442,7 @@ public class HttpOp {
      * Throw {@link HttpException} for any response that is not 2xx.
      */
     public static String httpHead(String url, String acceptHeader) {
-        return httpHead(HttpEnv.getDftHttpClient(), url, acceptHeader);
+        return httpHead(HttpEnv.getHttpClient(url), url, acceptHeader);
     }
 
     /**
diff --git a/jena-arq/src/main/java/org/apache/jena/http/HttpRDF.java 
b/jena-arq/src/main/java/org/apache/jena/http/HttpRDF.java
index 9ea825ee82..f7d5cbbaef 100644
--- a/jena-arq/src/main/java/org/apache/jena/http/HttpRDF.java
+++ b/jena-arq/src/main/java/org/apache/jena/http/HttpRDF.java
@@ -63,7 +63,7 @@ public class HttpRDF {
      * @throws HttpException
      */
     public static Graph httpGetGraph(String url) {
-        return httpGetGraph(HttpEnv.getDftHttpClient(), url);
+        return httpGetGraph(HttpEnv.getHttpClient(url), url);
     }
 
     /**
@@ -72,7 +72,7 @@ public class HttpRDF {
      * @throws HttpException
      */
     public static Graph httpGetGraph(String url, String acceptHeader) {
-        return httpGetGraph(HttpEnv.getDftHttpClient(), url, acceptHeader);
+        return httpGetGraph(HttpEnv.getHttpClient(url), url, acceptHeader);
     }
 
     /**
@@ -104,7 +104,7 @@ public class HttpRDF {
      * @throws HttpException
      */
     public static void httpGetToStream(String url, String acceptHeader, 
StreamRDF dest) {
-        httpGetToStream(HttpEnv.getDftHttpClient(), url, acceptHeader, dest);
+        httpGetToStream(HttpEnv.getHttpClient(url), url, acceptHeader, dest);
     }
 
     /**
@@ -170,7 +170,7 @@ public class HttpRDF {
     }
 
     public static void httpPostGraph(String url, Graph graph) {
-        httpPostGraph(HttpEnv.getDftHttpClient(), url, graph, 
HttpEnv.defaultTriplesFormat);
+        httpPostGraph(HttpEnv.getHttpClient(url), url, graph, 
HttpEnv.defaultTriplesFormat);
     }
 
     public static void httpPostGraph(HttpClient httpClient, String url, Graph 
graph, RDFFormat format) {
@@ -185,7 +185,7 @@ public class HttpRDF {
 
     /** Post a graph and expect an RDF graph back as the result. */
     public static Graph httpPostGraphRtn(String url, Graph graph) {
-        return httpPostGraphRtn(HttpEnv.getDftHttpClient(), url, graph,  
HttpEnv.defaultTriplesFormat, null);
+        return httpPostGraphRtn(HttpEnv.getHttpClient(url), url, graph,  
HttpEnv.defaultTriplesFormat, null);
     }
 
     /** Post a graph and expect an RDF graph back as the result. */
@@ -209,7 +209,7 @@ public class HttpRDF {
     }
 
     public static void httpPutGraph(String url, Graph graph) {
-        httpPutGraph(HttpEnv.getDftHttpClient(), url, graph, 
HttpEnv.defaultTriplesFormat);
+        httpPutGraph(HttpEnv.getHttpClient(url), url, graph, 
HttpEnv.defaultTriplesFormat);
     }
 
     public static void httpPutGraph(HttpClient httpClient, String url, Graph 
graph, RDFFormat fmt) {
@@ -254,7 +254,7 @@ public class HttpRDF {
     }
 
     public static void httpDeleteGraph(String url) {
-        httpDeleteGraph(HttpEnv.getDftHttpClient(), url);
+        httpDeleteGraph(HttpEnv.getHttpClient(url), url);
     }
 
     public static void httpDeleteGraph(HttpClient httpClient, String url) {

Reply via email to