Class ApacheHttpRequest
java.lang.Object
com.google.api.client.http.LowLevelHttpRequest
com.google.api.client.http.apache.v2.ApacheHttpRequest
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.http.client.HttpClient
private final org.apache.http.client.methods.HttpRequestBase
private org.apache.http.client.config.RequestConfig.Builder
-
Constructor Summary
ConstructorsConstructorDescriptionApacheHttpRequest
(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpRequestBase request) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a header to the HTTP request.execute()
Executes the request and returns a low-level HTTP response object.void
setTimeout
(int connectTimeout, int readTimeout) Sets the connection and read timeouts.Methods inherited from class com.google.api.client.http.LowLevelHttpRequest
getContentEncoding, getContentLength, getContentType, getStreamingContent, setContentEncoding, setContentLength, setContentType, setStreamingContent, setWriteTimeout
-
Field Details
-
httpClient
private final org.apache.http.client.HttpClient httpClient -
request
private final org.apache.http.client.methods.HttpRequestBase request -
requestConfig
private org.apache.http.client.config.RequestConfig.Builder requestConfig
-
-
Constructor Details
-
ApacheHttpRequest
ApacheHttpRequest(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpRequestBase request)
-
-
Method Details
-
addHeader
Description copied from class:LowLevelHttpRequest
Adds a header to the HTTP request.Note that multiple headers of the same name need to be supported, in which case
LowLevelHttpRequest.addHeader(java.lang.String, java.lang.String)
will be called for each instance of the header.- Specified by:
addHeader
in classLowLevelHttpRequest
- Parameters:
name
- header namevalue
- header value
-
setTimeout
Description copied from class:LowLevelHttpRequest
Sets the connection and read timeouts.Default implementation does nothing, but subclasses should normally override.
- Overrides:
setTimeout
in classLowLevelHttpRequest
- Parameters:
connectTimeout
- timeout in milliseconds to establish a connection or0
for an infinite timeoutreadTimeout
- Timeout in milliseconds to read data from an established connection or0
for an infinite timeout- Throws:
IOException
- I/O exception
-
execute
Description copied from class:LowLevelHttpRequest
Executes the request and returns a low-level HTTP response object.- Specified by:
execute
in classLowLevelHttpRequest
- Throws:
IOException
-