Top Description Fields Constructors Methods
org.eclipse.jgit.transport.http

public Class JDKHttpConnection

extends Object
implements HttpConnection
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.http.HttpConnection
Imports
java.io.IOException, .InputStream, .OutputStream, java.net.HttpURLConnection, .MalformedURLException, .ProtocolException, .Proxy, .URL, java.security.KeyManagementException, .NoSuchAlgorithmException, .SecureRandom, java.util.ArrayList, .List, .Map, javax.net.ssl.HostnameVerifier, .HttpsURLConnection, .KeyManager, .SSLContext, .SSLSocket, .TrustManager, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.internal.transport.http.DelegatingSSLSocketFactory, org.eclipse.jgit.util.HttpSupport

A org.eclipse.jgit.transport.http.HttpConnection which simply delegates every call to a java.net.HttpURLConnection. This is the default implementation used by JGit
Since
3.3

Field Summary

Modifier and TypeField and Description
pack-priv HttpURLConnection

Constructor Summary

AccessConstructor and Description
pack-priv
protected
JDKHttpConnection(URL
a java.net.URL object.
url
)

Constructor for JDKHttpConnection.

protected
JDKHttpConnection(URL
a java.net.URL object.
url
,
Proxy
a java.net.Proxy object.
proxy
)

Constructor for JDKHttpConnection.

Method Summary

Modifier and TypeMethod and Description
public void
configure(KeyManager[]
the keymanager managing the key material used to authenticate the local SSLSocket to its peer
km
,
TrustManager[]
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.
tm
,
SecureRandom
the source of randomness for this generator or null. See javax.net.ssl.SSLContext#init(KeyManager[], TrustManager[], SecureRandom)
random
)

Implements org.eclipse.jgit.transport.http.HttpConnection.configure.

Configure the connection so that it can be used for https communication.

public void
public int
public String
public String
getHeaderField(String
the name of a header field.
name
)

Implements org.eclipse.jgit.transport.http.HttpConnection.getHeaderField.

Get header field.

public Map<String, List<String>>
public List<String>
getHeaderFields(String
the name of a header field.
name
)

Implements org.eclipse.jgit.transport.http.HttpConnection.getHeaderFields.

Get all values of given header field.

public InputStream
public OutputStream
public String
public int
public String
public URL
private static List<String>
public void
setChunkedStreamingMode(int
The number of bytes to write in each chunk. If chunklen is less than or equal to zero, a default value will be used.
chunklen
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setChunkedStreamingMode.

Set chunked streaming mode

public void
setConnectTimeout(int
an int that specifies the connect timeout value in milliseconds
timeout
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setConnectTimeout.

Set connect timeout

public void
setDoOutput(boolean
the new value.
dooutput
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setDoOutput.

Set if to do output

public void
setFixedLengthStreamingMode(int
The number of bytes which will be written to the OutputStream.
contentLength
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setFixedLengthStreamingMode.

Set fixed length streaming mode

public void
public void
setInstanceFollowRedirects(boolean
a boolean indicating whether or not to follow HTTP redirects.
followRedirects
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setInstanceFollowRedirects.

Set whether or not to follow HTTP redirects.

public void
setReadTimeout(int
an int that specifies the timeout value to be used in milliseconds
timeout
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setReadTimeout.

Set read timeout

public void
public void
setRequestProperty(String
the keyword by which the request is known (e.g., " Accept").
key
,
String
the value associated with it.
value
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setRequestProperty.

Set request property

public void
setUseCaches(boolean
a boolean indicating whether or not to allow caching
usecaches
)

Implements org.eclipse.jgit.transport.http.HttpConnection.setUseCaches.

Set if to use caches

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

wrappedUrlConnectionback to summary
pack-priv HttpURLConnection wrappedUrlConnection

Constructor Detail

JDKHttpConnectionback to summary
pack-priv JDKHttpConnection(HttpURLConnection urlConnection)
JDKHttpConnectionback to summary
protected JDKHttpConnection(URL url) throws MalformedURLException, IOException

Constructor for JDKHttpConnection.

Parameters
url:URL

a java.net.URL object.

Exceptions
MalformedURLException:
if URL is malformed
IOException:
if an IO error occurred
JDKHttpConnectionback to summary
protected JDKHttpConnection(URL url, Proxy proxy) throws MalformedURLException, IOException

Constructor for JDKHttpConnection.

Parameters
url:URL

a java.net.URL object.

proxy:Proxy

a java.net.Proxy object.

Exceptions
MalformedURLException:
if URL is malformed
IOException:
if an IO error occurred

Method Detail

configureback to summary
public void configure(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws NoSuchAlgorithmException, KeyManagementException

Implements org.eclipse.jgit.transport.http.HttpConnection.configure.

Doc from org.eclipse.jgit.transport.http.HttpConnection.configure.

Configure the connection so that it can be used for https communication.

Parameters
km:KeyManager[]

the keymanager managing the key material used to authenticate the local SSLSocket to its peer

tm:TrustManager[]

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:SecureRandom

the source of randomness for this generator or null. See javax.net.ssl.SSLContext#init(KeyManager[], TrustManager[], SecureRandom)

Annotations
@Override
Exceptions
NoSuchAlgorithmException:
if algorithm isn't available
KeyManagementException:
if key management failed
connectback to summary
public void connect() throws IOException

Implements org.eclipse.jgit.transport.http.HttpConnection.connect.

Doc from org.eclipse.jgit.transport.http.HttpConnection.connect.

Connect

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
getContentLengthback to summary
public int getContentLength()

Implements org.eclipse.jgit.transport.http.HttpConnection.getContentLength.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getContentLength.

Get content length

Returns:int

the content length of the resource that this connection's URL references, -1 if the content length is not known, or if the content length is greater than Integer.MAX_VALUE.

Annotations
@Override
getContentTypeback to summary
public String getContentType()

Implements org.eclipse.jgit.transport.http.HttpConnection.getContentType.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getContentType.

Get content type

Returns:String

the content type of the resource that the URL references, or null if not known.

Annotations
@Override
getHeaderFieldback to summary
public String getHeaderField(String name)

Implements org.eclipse.jgit.transport.http.HttpConnection.getHeaderField.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getHeaderField.

Get header field. According to RFC 2616 header field names are case insensitive. Header fields defined as a comma separated list can have multiple header fields with the same field name. This method only returns one of these header fields. If you want the union of all values of all multiple header fields with the same field name then use getHeaderFields(String)

Parameters
name:String

the name of a header field.

Returns:String

the value of the named header field, or null if there is no such field in the header.

Annotations
@Override
getHeaderFieldsback to summary
public Map<String, List<String>> getHeaderFields()

Implements org.eclipse.jgit.transport.http.HttpConnection.getHeaderFields.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getHeaderFields.

Get map of header fields

Returns:Map<String, List<String>>

a Map of header fields

Annotations
@Override
getHeaderFieldsback to summary
public List<String> getHeaderFields(String name)

Implements org.eclipse.jgit.transport.http.HttpConnection.getHeaderFields.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getHeaderFields.

Get all values of given header field. According to RFC 2616 header field names are case insensitive. Header fields defined as a comma separated list can have multiple header fields with the same field name. This method does not validate if the given header field is defined as a comma separated list.

Parameters
name:String

the name of a header field.

Returns:List<String>

the list of values of the named header field

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Implements org.eclipse.jgit.transport.http.HttpConnection.getInputStream.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getInputStream.

Get input stream

Returns:InputStream

an input stream that reads from this open connection.

Annotations
@Override
Exceptions
IOException:
  • if an I/O error occurs while creating the input stream.
  • if an IO error occurred
getOutputStreamback to summary
public OutputStream getOutputStream() throws IOException

Implements org.eclipse.jgit.transport.http.HttpConnection.getOutputStream.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getOutputStream.

Get output stream

Returns:OutputStream

an output stream that writes to this connection.

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
getRequestMethodback to summary
public String getRequestMethod()

Implements org.eclipse.jgit.transport.http.HttpConnection.getRequestMethod.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getRequestMethod.

Get request method

Returns:String

the HTTP request method

Annotations
@Override
getResponseCodeback to summary
public int getResponseCode() throws IOException

Implements org.eclipse.jgit.transport.http.HttpConnection.getResponseCode.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getResponseCode.

Get response code

Returns:int

the HTTP Status-Code, or -1

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
getResponseMessageback to summary
public String getResponseMessage() throws IOException

Implements org.eclipse.jgit.transport.http.HttpConnection.getResponseMessage.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getResponseMessage.

Get response message

Returns:String

the HTTP response message, or null

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
getURLback to summary
public URL getURL()

Implements org.eclipse.jgit.transport.http.HttpConnection.getURL.

Doc from org.eclipse.jgit.transport.http.HttpConnection.getURL.

Get URL

Returns:URL

the URL.

Annotations
@Override
mapValuesToListIgnoreCaseback to summary
private static List<String> mapValuesToListIgnoreCase(String keyName, Map<String, List<String>> m)
setChunkedStreamingModeback to summary
public void setChunkedStreamingMode(int chunklen)

Implements org.eclipse.jgit.transport.http.HttpConnection.setChunkedStreamingMode.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setChunkedStreamingMode.

Set chunked streaming mode

Parameters
chunklen:int

The number of bytes to write in each chunk. If chunklen is less than or equal to zero, a default value will be used.

Annotations
@Override
setConnectTimeoutback to summary
public void setConnectTimeout(int timeout)

Implements org.eclipse.jgit.transport.http.HttpConnection.setConnectTimeout.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setConnectTimeout.

Set connect timeout

Parameters
timeout:int

an int that specifies the connect timeout value in milliseconds

Annotations
@Override
setDoOutputback to summary
public void setDoOutput(boolean dooutput)

Implements org.eclipse.jgit.transport.http.HttpConnection.setDoOutput.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setDoOutput.

Set if to do output

Parameters
dooutput:boolean

the new value.

Annotations
@Override
setFixedLengthStreamingModeback to summary
public void setFixedLengthStreamingMode(int contentLength)

Implements org.eclipse.jgit.transport.http.HttpConnection.setFixedLengthStreamingMode.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setFixedLengthStreamingMode.

Set fixed length streaming mode

Parameters
contentLength:int

The number of bytes which will be written to the OutputStream.

Annotations
@Override
setHostnameVerifierback to summary
public void setHostnameVerifier(HostnameVerifier hostnameverifier)

Implements org.eclipse.jgit.transport.http.HttpConnection.setHostnameVerifier.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setHostnameVerifier.

Set the javax.net.ssl.HostnameVerifier used during https communication

Parameters
hostnameverifier:HostnameVerifier

a javax.net.ssl.HostnameVerifier object.

Annotations
@Override
setInstanceFollowRedirectsback to summary
public void setInstanceFollowRedirects(boolean followRedirects)

Implements org.eclipse.jgit.transport.http.HttpConnection.setInstanceFollowRedirects.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setInstanceFollowRedirects.

Set whether or not to follow HTTP redirects.

Parameters
followRedirects:boolean

a boolean indicating whether or not to follow HTTP redirects.

Annotations
@Override
setReadTimeoutback to summary
public void setReadTimeout(int timeout)

Implements org.eclipse.jgit.transport.http.HttpConnection.setReadTimeout.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setReadTimeout.

Set read timeout

Parameters
timeout:int

an int that specifies the timeout value to be used in milliseconds

Annotations
@Override
setRequestMethodback to summary
public void setRequestMethod(String method) throws ProtocolException

Implements org.eclipse.jgit.transport.http.HttpConnection.setRequestMethod.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setRequestMethod.

Set request method

Parameters
method:String

the HTTP method

Annotations
@Override
Exceptions
ProtocolException:
  • if the method cannot be reset or if the requested method isn't valid for HTTP.
  • if any.
setRequestPropertyback to summary
public void setRequestProperty(String key, String value)

Implements org.eclipse.jgit.transport.http.HttpConnection.setRequestProperty.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setRequestProperty.

Set request property

Parameters
key:String

the keyword by which the request is known (e.g., " Accept").

value:String

the value associated with it.

Annotations
@Override
setUseCachesback to summary
public void setUseCaches(boolean usecaches)

Implements org.eclipse.jgit.transport.http.HttpConnection.setUseCaches.

Doc from org.eclipse.jgit.transport.http.HttpConnection.setUseCaches.

Set if to use caches

Parameters
usecaches:boolean

a boolean indicating whether or not to allow caching

Annotations
@Override
usingProxyback to summary
public boolean usingProxy()

Implements org.eclipse.jgit.transport.http.HttpConnection.usingProxy.

Doc from org.eclipse.jgit.transport.http.HttpConnection.usingProxy.

Whether we use a proxy

Returns:boolean

a boolean indicating if the connection is using a proxy.

Annotations
@Override