com.google.api.client.http
Class LowLevelHttpRequest

java.lang.Object
  extended by com.google.api.client.http.LowLevelHttpRequest
Direct Known Subclasses:
MockLowLevelHttpRequest

public abstract class LowLevelHttpRequest
extends Object

Low-level HTTP request.

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.

Since:
1.0
Author:
Yaniv Inbar

Constructor Summary
LowLevelHttpRequest()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LowLevelHttpRequest

public LowLevelHttpRequest()
Method Detail

addHeader

public abstract void addHeader(String name,
                               String value)
Adds a header to the HTTP request.

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.

Parameters:
name - header name
value - header value

setContent

public abstract void setContent(HttpContent content)
                         throws IOException
Sets the HTTP request content.

Throws:
IOException - I/O exception

setTimeout

public void setTimeout(int connectTimeout,
                       int readTimeout)
                throws IOException
Sets the connection and read timeouts.

Default implementation does nothing, but subclasses should normally override.

Parameters:
connectTimeout - timeout in milliseconds to establish a connection or 0 for an infinite timeout
readTimeout - Timeout in milliseconds to read data from an established connection or 0 for an infinite timeout
Throws:
IOException - I/O exception
Since:
1.4

execute

public abstract LowLevelHttpResponse execute()
                                      throws IOException
Executes the request and returns a low-level HTTP response object.

Throws:
IOException


Copyright © 2011-2012 Google. All Rights Reserved.