public class HttpClientConnection extends Object implements HttpConnection
HttpConnection which uses HttpClientHTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_OK, HTTP_UNAUTHORIZED| Constructor and Description |
|---|
HttpClientConnection(String urlStr) |
HttpClientConnection(String urlStr,
Proxy proxy) |
HttpClientConnection(String urlStr,
Proxy proxy,
org.apache.http.client.HttpClient cl) |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(KeyManager[] km,
TrustManager[] tm,
SecureRandom random)
Configure the connection so that it can be used for https communication.
|
void |
connect() |
int |
getContentLength() |
String |
getContentType() |
String |
getHeaderField(String name) |
Map<String,List<String>> |
getHeaderFields() |
InputStream |
getInputStream() |
OutputStream |
getOutputStream() |
String |
getRequestMethod() |
int |
getResponseCode() |
String |
getResponseMessage() |
URL |
getURL() |
void |
setBuffer(TemporaryBuffer buffer)
Sets the buffer from which to take the request body
|
void |
setChunkedStreamingMode(int chunklen) |
void |
setConnectTimeout(int timeout) |
void |
setDoOutput(boolean dooutput) |
void |
setFixedLengthStreamingMode(int contentLength) |
void |
setHostnameVerifier(HostnameVerifier hostnameverifier)
Set the
HostnameVerifier used during https communication |
void |
setInstanceFollowRedirects(boolean followRedirects) |
void |
setReadTimeout(int readTimeout) |
void |
setRequestMethod(String method) |
void |
setRequestProperty(String name,
String value) |
void |
setUseCaches(boolean usecaches) |
boolean |
usingProxy() |
public HttpClientConnection(String urlStr)
urlStr - public HttpClientConnection(String urlStr, Proxy proxy)
urlStr - proxy - public void setBuffer(TemporaryBuffer buffer)
buffer - public int getResponseCode()
throws IOException
getResponseCode in interface HttpConnectionIOExceptionHttpURLConnection.getResponseCode()public URL getURL()
getURL in interface HttpConnectionURLConnection.getURL()public String getResponseMessage() throws IOException
getResponseMessage in interface HttpConnectionnullIOExceptionHttpURLConnection.getResponseMessage()public Map<String,List<String>> getHeaderFields()
getHeaderFields in interface HttpConnectionURLConnection.getHeaderFields()public void setRequestProperty(String name, String value)
setRequestProperty in interface HttpConnectionname - the keyword by which the request is known (e.g., "
Accept").value - the value associated with it.URLConnection.setRequestProperty(String, String)public void setRequestMethod(String method) throws ProtocolException
setRequestMethod in interface HttpConnectionmethod - the HTTP methodProtocolException - if the method cannot be reset or if the requested method
isn't valid for HTTP.HttpURLConnection.setRequestMethod(String)public void setUseCaches(boolean usecaches)
setUseCaches in interface HttpConnectionusecaches - a boolean indicating whether or not to allow
cachingURLConnection.setUseCaches(boolean)public void setConnectTimeout(int timeout)
setConnectTimeout in interface HttpConnectiontimeout - an int that specifies the connect timeout value
in millisecondsURLConnection.setConnectTimeout(int)public void setReadTimeout(int readTimeout)
setReadTimeout in interface HttpConnectionreadTimeout - an int that specifies the timeout value to be
used in millisecondsURLConnection.setReadTimeout(int)public String getContentType()
getContentType in interface HttpConnectionnull if not known.URLConnection.getContentType()public InputStream getInputStream() throws IOException
getInputStream in interface HttpConnectionIOException - if an I/O error occurs while creating the input stream.URLConnection.getInputStream()public String getHeaderField(String name)
getHeaderField in interface HttpConnectionname - the name of a header field.null if
there is no such field in the header.URLConnection.getHeaderField(String)public int getContentLength()
getContentLength in interface HttpConnection-1 if the content length is not known, or if
the content length is greater than Integer.MAX_VALUE.URLConnection.getContentLength()public void setInstanceFollowRedirects(boolean followRedirects)
setInstanceFollowRedirects in interface HttpConnectionfollowRedirects - a boolean indicating whether or not to follow
HTTP redirects.HttpURLConnection.setInstanceFollowRedirects(boolean)public void setDoOutput(boolean dooutput)
setDoOutput in interface HttpConnectiondooutput - the new value.URLConnection.setDoOutput(boolean)public void setFixedLengthStreamingMode(int contentLength)
setFixedLengthStreamingMode in interface HttpConnectioncontentLength - The number of bytes which will be written to the OutputStream.HttpURLConnection.setFixedLengthStreamingMode(int)public OutputStream getOutputStream() throws IOException
getOutputStream in interface HttpConnectionIOExceptionURLConnection.getOutputStream()public void setChunkedStreamingMode(int chunklen)
setChunkedStreamingMode in interface HttpConnectionchunklen - The number of bytes to write in each chunk. If chunklen is
less than or equal to zero, a default value will be used.HttpURLConnection.setChunkedStreamingMode(int)public String getRequestMethod()
getRequestMethod in interface HttpConnectionHttpURLConnection.getRequestMethod()public boolean usingProxy()
usingProxy in interface HttpConnectionHttpURLConnection.usingProxy()public void connect()
throws IOException
connect in interface HttpConnectionIOExceptionURLConnection.connect()public void setHostnameVerifier(HostnameVerifier hostnameverifier)
HttpConnectionHostnameVerifier used during https communicationsetHostnameVerifier in interface HttpConnectionpublic void configure(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws KeyManagementException
HttpConnectionconfigure in interface HttpConnectionkm - the keymanager managing the key material used to authenticate
the local SSLSocket to its peertm - the trustmanager responsible for managing the trust material
that is used when making trust decisions, and for deciding
whether credentials presented by a peer should be accepted.random - the source of randomness for this generator or null. See
SSLContext.init(KeyManager[], TrustManager[], SecureRandom)KeyManagementExceptionCopyright © 2015 Eclipse JGit Project. All rights reserved.