diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-02-03 11:34:35 +0100 |
---|---|---|
committer | Saša Živkov <sasa.zivkov@sap.com> | 2016-02-04 17:49:43 +0100 |
commit | c901cd89d35fe2cc014c7e0f5849e32a14fe679a (patch) | |
tree | 5de574ca65216c28bef777d4b249fd9200f498ed /org.eclipse.jgit.http.apache | |
parent | a0e1374e2259e4e2bd5da1a76bc716c134728e95 (diff) | |
download | jgit-c901cd89d35fe2cc014c7e0f5849e32a14fe679a.tar.gz jgit-c901cd89d35fe2cc014c7e0f5849e32a14fe679a.zip |
Add support for HEAD requests to HttpClientConnection
Change-Id: I501f37e06b686a3a0bb5fd857dd72e424da91d3e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.http.apache')
-rw-r--r-- | org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java index de81bf82bf..a0eeef89fc 100644 --- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java +++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java @@ -42,6 +42,11 @@ */ package org.eclipse.jgit.transport.http.apache; +import static org.eclipse.jgit.util.HttpSupport.METHOD_GET; +import static org.eclipse.jgit.util.HttpSupport.METHOD_HEAD; +import static org.eclipse.jgit.util.HttpSupport.METHOD_POST; +import static org.eclipse.jgit.util.HttpSupport.METHOD_PUT; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -76,6 +81,7 @@ import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpHead; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpUriRequest; @@ -250,13 +256,15 @@ public class HttpClientConnection implements HttpConnection { public void setRequestMethod(String method) throws ProtocolException { this.method = method; - if ("GET".equalsIgnoreCase(method)) //$NON-NLS-1$ + if (METHOD_GET.equalsIgnoreCase(method)) { req = new HttpGet(url.toString()); - else if ("PUT".equalsIgnoreCase(method)) //$NON-NLS-1$ + } else if (METHOD_HEAD.equalsIgnoreCase(method)) { + req = new HttpHead(url.toString()); + } else if (METHOD_PUT.equalsIgnoreCase(method)) { req = new HttpPut(url.toString()); - else if ("POST".equalsIgnoreCase(method)) //$NON-NLS-1$ + } else if (METHOD_POST.equalsIgnoreCase(method)) { req = new HttpPost(url.toString()); - else { + } else { this.method = null; throw new UnsupportedOperationException(); } |