You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/05/17 10:40:57 UTC

[2/3] jena git commit: Split exec() on auth

Split exec() on auth


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/20dedc6c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/20dedc6c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/20dedc6c

Branch: refs/heads/master
Commit: 20dedc6c99394f8be3797b9b08318503d8fe716a
Parents: d67a426
Author: Andy Seaborne <an...@apache.org>
Authored: Tue May 17 11:34:07 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue May 17 11:34:07 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/jena/riot/web/HttpOp.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/20dedc6c/jena-arq/src/main/java/org/apache/jena/riot/web/HttpOp.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/web/HttpOp.java b/jena-arq/src/main/java/org/apache/jena/riot/web/HttpOp.java
index 3c64815..52d1562 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/web/HttpOp.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/web/HttpOp.java
@@ -1176,10 +1176,17 @@ public class HttpOp {
     }
 
     // ---- Perform the operation!
-    // With logging.
 
     private static void exec(String url, HttpUriRequest request, String acceptHeader, HttpResponseHandler handler,
-            HttpClient httpClient, HttpContext httpContext, HttpAuthenticator authenticator) {
+                             HttpClient httpClient, HttpContext httpContext, HttpAuthenticator authenticator) {
+        // Prepare authentication, if any.
+        httpClient = ensureClient(httpClient, authenticator);
+        httpContext = ensureContext(httpContext);
+        applyAuthentication(asAbstractClient(httpClient), url, httpContext, authenticator);
+        exec(url, request, acceptHeader, handler, httpClient, httpContext); 
+    }
+    
+    private static void exec(String url, HttpUriRequest request, String acceptHeader, HttpResponseHandler handler, HttpClient httpClient, HttpContext httpContext) {
         try {
             if (handler == null)
                 // This cleans up.
@@ -1196,10 +1203,6 @@ public class HttpOp {
             // User-Agent
             applyUserAgent(request);
 
-            // Prepare and execute
-            httpClient = ensureClient(httpClient, authenticator);
-            httpContext = ensureContext(httpContext);
-            applyAuthentication(asAbstractClient(httpClient), url, httpContext, authenticator);
             HttpResponse response = httpClient.execute(request, httpContext);
 
             // Response