public interface HttpConnection
HttpURLConnection
which is used by JGit| Modifier and Type | Field and Description |
|---|---|
static int |
HTTP_11_MOVED_TEMP
HTTP 1.1 additional MOVED_TEMP status code; value = 307.
|
static int |
HTTP_FORBIDDEN |
static int |
HTTP_MOVED_PERM |
static int |
HTTP_MOVED_TEMP |
static int |
HTTP_NOT_FOUND |
static int |
HTTP_OK |
static int |
HTTP_SEE_OTHER |
static int |
HTTP_UNAUTHORIZED |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(javax.net.ssl.KeyManager[] km,
javax.net.ssl.TrustManager[] tm,
java.security.SecureRandom random)
Configure the connection so that it can be used for https communication.
|
void |
connect()
Connect
|
int |
getContentLength()
Get content length
|
java.lang.String |
getContentType()
Get content type
|
java.lang.String |
getHeaderField(java.lang.String name)
Get header field
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaderFields()
Get list of header fields
|
java.io.InputStream |
getInputStream()
Get input stream
|
java.io.OutputStream |
getOutputStream()
Get output stream
|
java.lang.String |
getRequestMethod()
Get request method
|
int |
getResponseCode()
Get response code
|
java.lang.String |
getResponseMessage()
Get response message
|
java.net.URL |
getURL()
Get URL
|
void |
setChunkedStreamingMode(int chunklen)
Set chunked streaming mode
|
void |
setConnectTimeout(int timeout)
Set connect timeout
|
void |
setDoOutput(boolean dooutput)
Set if to do output
|
void |
setFixedLengthStreamingMode(int contentLength)
Set fixed length streaming mode
|
void |
setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameverifier)
Set the
HostnameVerifier used during https
communication |
void |
setInstanceFollowRedirects(boolean followRedirects)
Set whether or not to follow HTTP redirects.
|
void |
setReadTimeout(int timeout)
Set read timeout
|
void |
setRequestMethod(java.lang.String method)
Set request method
|
void |
setRequestProperty(java.lang.String key,
java.lang.String value)
Set request property
|
void |
setUseCaches(boolean usecaches)
Set if to use caches
|
boolean |
usingProxy()
Whether we use a proxy
|
static final int HTTP_OK
HttpURLConnection.HTTP_OK,
Constant Field Valuesstatic final int HTTP_MOVED_PERM
HttpURLConnection.HTTP_MOVED_PERM,
Constant Field Valuesstatic final int HTTP_MOVED_TEMP
HttpURLConnection.HTTP_MOVED_TEMP,
Constant Field Valuesstatic final int HTTP_SEE_OTHER
HttpURLConnection.HTTP_SEE_OTHER,
Constant Field Valuesstatic final int HTTP_11_MOVED_TEMP
HTTP_MOVED_TEMP,
Constant Field Valuesstatic final int HTTP_NOT_FOUND
HttpURLConnection.HTTP_NOT_FOUND,
Constant Field Valuesstatic final int HTTP_UNAUTHORIZED
HttpURLConnection.HTTP_UNAUTHORIZED,
Constant Field Valuesstatic final int HTTP_FORBIDDEN
HttpURLConnection.HTTP_FORBIDDEN,
Constant Field Valuesint getResponseCode()
throws java.io.IOException
java.io.IOExceptionHttpURLConnection.getResponseCode()java.net.URL getURL()
URLConnection.getURL()java.lang.String getResponseMessage()
throws java.io.IOException
nulljava.io.IOExceptionHttpURLConnection.getResponseMessage()java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaderFields()
URLConnection.getHeaderFields()void setRequestProperty(java.lang.String key,
java.lang.String value)
key - the keyword by which the request is known (e.g., "
Accept").value - the value associated with it.URLConnection.setRequestProperty(String, String)void setRequestMethod(java.lang.String method)
throws java.net.ProtocolException
method - the HTTP methodjava.net.ProtocolException - if the method cannot be reset or if the requested method
isn't valid for HTTP.java.net.ProtocolException - if any.HttpURLConnection.setRequestMethod(String)void setUseCaches(boolean usecaches)
usecaches - a boolean indicating whether or not to allow
cachingURLConnection.setUseCaches(boolean)void setConnectTimeout(int timeout)
timeout - an int that specifies the connect timeout value
in millisecondsURLConnection.setConnectTimeout(int)void setReadTimeout(int timeout)
timeout - an int that specifies the timeout value to be
used in millisecondsURLConnection.setReadTimeout(int)java.lang.String getContentType()
null if not known.URLConnection.getContentType()java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOException - if an I/O error occurs while creating the input stream.java.io.IOException - if any.URLConnection.getInputStream()java.lang.String getHeaderField(java.lang.String name)
name - the name of a header field.null if
there is no such field in the header.URLConnection.getHeaderField(String)int getContentLength()
-1 if the content length is not known, or if
the content length is greater than Integer.MAX_VALUE.URLConnection.getContentLength()void setInstanceFollowRedirects(boolean followRedirects)
followRedirects - a boolean indicating whether or not to follow
HTTP redirects.HttpURLConnection.setInstanceFollowRedirects(boolean)void setDoOutput(boolean dooutput)
dooutput - the new value.URLConnection.setDoOutput(boolean)void setFixedLengthStreamingMode(int contentLength)
contentLength - The number of bytes which will be written to the OutputStream.HttpURLConnection.setFixedLengthStreamingMode(int)java.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOExceptionURLConnection.getOutputStream()void setChunkedStreamingMode(int chunklen)
chunklen - 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)java.lang.String getRequestMethod()
HttpURLConnection.getRequestMethod()boolean usingProxy()
HttpURLConnection.usingProxy()void connect()
throws java.io.IOException
java.io.IOExceptionURLConnection.connect()void configure(javax.net.ssl.KeyManager[] km,
javax.net.ssl.TrustManager[] tm,
java.security.SecureRandom random)
throws java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
km - 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)java.security.NoSuchAlgorithmExceptionjava.security.KeyManagementExceptionvoid setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameverifier)
throws java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
HostnameVerifier used during https
communicationhostnameverifier - a HostnameVerifier object.java.security.NoSuchAlgorithmExceptionjava.security.KeyManagementException