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

public Class HttpClientConnection

extends Object
implements HttpConnection
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.http.HttpConnection
Static Imports
org.eclipse.jgit.util.HttpSupport.METHOD_GET, .HttpSupport.METHOD_HEAD, .HttpSupport.METHOD_POST, .HttpSupport.METHOD_PUT

A org.eclipse.jgit.transport.http.HttpConnection which uses org.apache.http.client.HttpClient
Since
3.3

Field Summary

Modifier and TypeField and Description
pack-priv HttpClient
private SSLContext
private TemporaryBufferEntity
private Boolean
private HostnameVerifier
private boolean
pack-priv String
private Proxy
private Integer
pack-priv HttpUriRequest
pack-priv HttpResponse
private SSLConnectionSocketFactory
private Integer
pack-priv URL
private boolean

Constructor Summary

AccessConstructor and Description
public
HttpClientConnection(String
url string
urlStr
)

Constructor for HttpClientConnection.

public
HttpClientConnection(String
url string
urlStr
,
Proxy
proxy
proxy
)

Constructor for HttpClientConnection.

public
HttpClientConnection(String
url string
urlStr
,
Proxy
proxy
proxy
,
HttpClient
client
cl
)

Constructor for HttpClientConnection.

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
private void
private HttpClient
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
private SSLContext
private SSLConnectionSocketFactory
public URL
public void
setBuffer(TemporaryBuffer
the buffer
buffer
)

Sets the buffer from which to take the request body

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
readTimeout
)

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").
name
,
String
the value associated with it.
value
)

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

Set request property

pack-priv void
setSSLSocketFactory(SSLConnectionSocketFactory factory, boolean isDefault)

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

clientback to summary
pack-priv HttpClient client
ctxback to summary
private SSLContext ctx
entityback to summary
private TemporaryBufferEntity entity
followRedirectsback to summary
private Boolean followRedirects
hostnameverifierback to summary
private HostnameVerifier hostnameverifier
isUsingProxyback to summary
private boolean isUsingProxy
methodback to summary
pack-priv String method
proxyback to summary
private Proxy proxy
readTimeoutback to summary
private Integer readTimeout
reqback to summary
pack-priv HttpUriRequest req
respback to summary
pack-priv HttpResponse resp
socketFactoryback to summary
private SSLConnectionSocketFactory socketFactory
timeoutback to summary
private Integer timeout
urlback to summary
pack-priv URL url
usePoolingback to summary
private boolean usePooling

Constructor Detail

HttpClientConnectionback to summary
public HttpClientConnection(String urlStr) throws MalformedURLException

Constructor for HttpClientConnection.

Parameters
urlStr:String

url string

Exceptions
MalformedURLException:
if url is malformed
HttpClientConnectionback to summary
public HttpClientConnection(String urlStr, Proxy proxy) throws MalformedURLException

Constructor for HttpClientConnection.

Parameters
urlStr:String

url string

proxy:Proxy

proxy

Exceptions
MalformedURLException:
if url is malformed
HttpClientConnectionback to summary
public HttpClientConnection(String urlStr, Proxy proxy, HttpClient cl) throws MalformedURLException

Constructor for HttpClientConnection.

Parameters
urlStr:String

url string

proxy:Proxy

proxy

cl:HttpClient

client

Exceptions
MalformedURLException:
if url is malformed

Method Detail

configureback to summary
public void configure(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws 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
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
executeback to summary
private void execute() throws IOException, ClientProtocolException
getClientback to summary
private HttpClient getClient()
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
getSSLContextback to summary
private SSLContext getSSLContext()
getSSLSocketFactoryback to summary
private SSLConnectionSocketFactory getSSLSocketFactory()
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
setBufferback to summary
public void setBuffer(TemporaryBuffer buffer)

Sets the buffer from which to take the request body

Parameters
buffer:TemporaryBuffer

the buffer

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 readTimeout)

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

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

Set read timeout

Parameters
readTimeout: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 name, String value)

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

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

Set request property

Parameters
name:String

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

value:String

the value associated with it.

Annotations
@Override
setSSLSocketFactoryback to summary
pack-priv void setSSLSocketFactory(SSLConnectionSocketFactory factory, boolean isDefault)
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