Class NetHttpRequest
java.lang.Object
com.google.api.client.http.LowLevelHttpRequest
com.google.api.client.http.javanet.NetHttpRequest
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpURLConnectionprivate static final NetHttpRequest.OutputWriterprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a header to the HTTP request.execute()Executes the request and returns a low-level HTTP response object.(package private) LowLevelHttpResponseexecute(NetHttpRequest.OutputWriter outputWriter) (package private) StringgetRequestProperty(String name) private booleanhasResponse(HttpURLConnection connection) voidsetTimeout(int connectTimeout, int readTimeout) Sets the connection and read timeouts.voidsetWriteTimeout(int writeTimeout) Sets the write timeout for POST/PUT requests.private voidwriteContentToOutputStream(NetHttpRequest.OutputWriter outputWriter, OutputStream out) Methods inherited from class LowLevelHttpRequest
getContentEncoding, getContentLength, getContentType, getStreamingContent, setContentEncoding, setContentLength, setContentType, setStreamingContent
-
Field Details
-
connection
-
writeTimeout
private int writeTimeout -
DEFAULT_CONNECTION_WRITER
-
-
Constructor Details
-
NetHttpRequest
NetHttpRequest(HttpURLConnection connection) - Parameters:
connection- HTTP URL connection
-
-
Method Details
-
addHeader
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(String, String)will be called for each instance of the header.- Specified by:
addHeaderin classLowLevelHttpRequest- Parameters:
name- header namevalue- header value
-
getRequestProperty
-
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
-
setWriteTimeout
Description copied from class:LowLevelHttpRequestSets the write timeout for POST/PUT requests.Default implementation does nothing, but subclasses should normally override.
- Overrides:
setWriteTimeoutin classLowLevelHttpRequest- Parameters:
writeTimeout- timeout in milliseconds to establish a connection or0for an infinite timeout- Throws:
IOException- I/O exception
-
execute
Description copied from class:LowLevelHttpRequestExecutes the request and returns a low-level HTTP response object.- Specified by:
executein classLowLevelHttpRequest- Throws:
IOException
-
execute
- Throws:
IOException
-
hasResponse
-
writeContentToOutputStream
private void writeContentToOutputStream(NetHttpRequest.OutputWriter outputWriter, OutputStream out) throws IOException - Throws:
IOException
-