Class NetHttpRequest
- java.lang.Object
-
- com.google.api.client.http.LowLevelHttpRequest
-
- com.google.api.client.http.javanet.NetHttpRequest
-
final class NetHttpRequest extends LowLevelHttpRequest
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.HttpURLConnectionconnection
-
Constructor Summary
Constructors Constructor Description NetHttpRequest(java.net.HttpURLConnection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHeader(java.lang.String name, java.lang.String value)Adds a header to the HTTP request.LowLevelHttpResponseexecute()Executes the request and returns a low-level HTTP response object.voidsetTimeout(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
-
-
-
-
Method Detail
-
addHeader
public void addHeader(java.lang.String name, java.lang.String value)Description copied from class:LowLevelHttpRequestAdds 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:
addHeaderin classLowLevelHttpRequest- Parameters:
name- header namevalue- header value
-
setTimeout
public void setTimeout(int connectTimeout, int readTimeout)Description copied from class:LowLevelHttpRequestSets the connection and read timeouts.Default implementation does nothing, but subclasses should normally override.
- Overrides:
setTimeoutin classLowLevelHttpRequest- Parameters:
connectTimeout- timeout in milliseconds to establish a connection or0for an infinite timeoutreadTimeout- Timeout in milliseconds to read data from an established connection or0for an infinite timeout
-
execute
public LowLevelHttpResponse execute() throws java.io.IOException
Description copied from class:LowLevelHttpRequestExecutes the request and returns a low-level HTTP response object.- Specified by:
executein classLowLevelHttpRequest- Throws:
java.io.IOException
-
-