public abstract class LowLevelHttpRequest extends Object
This allows providing a different implementation of the HTTP request that is more compatible with the Java environment used.
Implementation has no fields and therefore thread-safe, but sub-classes are not necessarily thread-safe.
Constructor and Description |
---|
LowLevelHttpRequest() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addHeader(String name,
String value)
Adds a header to the HTTP request.
|
abstract LowLevelHttpResponse |
execute()
Executes the request and returns a low-level HTTP response object.
|
abstract void |
setContent(HttpContent content)
Sets the HTTP request content.
|
void |
setTimeout(int connectTimeout,
int readTimeout)
Sets the connection and read timeouts.
|
public abstract void addHeader(String name, String value) throws IOException
Note that multiple headers of the same name need to be supported, in which case
addHeader(java.lang.String, java.lang.String)
will be called for each instance of the header.
name
- header namevalue
- header valueIOException
public abstract void setContent(HttpContent content) throws IOException
IOException
public void setTimeout(int connectTimeout, int readTimeout) throws IOException
Default implementation does nothing, but subclasses should normally override.
connectTimeout
- timeout in milliseconds to establish a connection or 0
for an
infinite timeoutreadTimeout
- Timeout in milliseconds to read data from an established connection or
0
for an infinite timeoutIOException
- I/O exceptionpublic abstract LowLevelHttpResponse execute() throws IOException
IOException
Copyright © 2011-2012 Google. All Rights Reserved.