com.google.api.client.http
Class HttpTransport

java.lang.Object
  extended by com.google.api.client.http.HttpTransport
Direct Known Subclasses:
GoogleTransport

public class HttpTransport
extends Object

HTTP transport.

Warning: this class must not be sub-classed. It is scheduled to be made final in version 1.1.

Since:
1.0
Author:
Yaniv Inbar

Field Summary
 HttpHeaders defaultHeaders
          Default HTTP headers.
 List<HttpExecuteIntercepter> intercepters
          HTTP request execute intercepters.
 
Constructor Summary
HttpTransport()
           
 
Method Summary
 void addParser(HttpParser parser)
          Adds an HTTP response content parser.
 HttpRequest buildDeleteRequest()
          Builds a DELETE request.
 HttpRequest buildGetRequest()
          Builds a GET request.
 HttpRequest buildHeadRequest()
          Builds a HEAD request.
 HttpRequest buildPatchRequest()
          Builds a PATCH request.
 HttpRequest buildPostRequest()
          Builds a POST request.
 HttpRequest buildPutRequest()
          Builds a PUT request.
 HttpRequest buildRequest()
          Builds a request without specifying the HTTP method.
 HttpParser getParser(String contentType)
          Returns the HTTP response content parser to use for the given content type or null if none is defined.
 void removeIntercepters(Class<?> intercepterClass)
          Removes HTTP request execute intercepters of the given class or subclasses.
static void setLowLevelHttpTransport(LowLevelHttpTransport lowLevelHttpTransport)
          Sets to the given low level HTTP transport.
static LowLevelHttpTransport useLowLevelHttpTransport()
          Returns the low-level HTTP transport to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultHeaders

public HttpHeaders defaultHeaders
Default HTTP headers. These transport default headers are put into a request's headers when its build method is called.


intercepters

public List<HttpExecuteIntercepter> intercepters
HTTP request execute intercepters. The intercepters will be invoked in the order of the List.iterator().

Constructor Detail

HttpTransport

public HttpTransport()
Method Detail

setLowLevelHttpTransport

public static void setLowLevelHttpTransport(LowLevelHttpTransport lowLevelHttpTransport)
Sets to the given low level HTTP transport.

Must be set before the first HTTP transport is constructed or else the default will be used as specified in useLowLevelHttpTransport().

Parameters:
lowLevelHttpTransport - low level HTTP transport or null to use the default of java.net transport

useLowLevelHttpTransport

public static LowLevelHttpTransport useLowLevelHttpTransport()
Returns the low-level HTTP transport to use. If setLowLevelHttpTransport(LowLevelHttpTransport) hasn't been called, it uses the default of java.net transport.


addParser

public void addParser(HttpParser parser)
Adds an HTTP response content parser.

If there is already a previous parser defined for this new parser (as defined by getParser(String) then the previous parser will be removed.


getParser

public HttpParser getParser(String contentType)
Returns the HTTP response content parser to use for the given content type or null if none is defined.

Parameters:
contentType - content type or null for null result

buildRequest

public HttpRequest buildRequest()
Builds a request without specifying the HTTP method.


buildDeleteRequest

public HttpRequest buildDeleteRequest()
Builds a DELETE request.


buildGetRequest

public HttpRequest buildGetRequest()
Builds a GET request.


buildPostRequest

public HttpRequest buildPostRequest()
Builds a POST request.


buildPutRequest

public HttpRequest buildPutRequest()
Builds a PUT request.


buildPatchRequest

public HttpRequest buildPatchRequest()
Builds a PATCH request.


buildHeadRequest

public HttpRequest buildHeadRequest()
Builds a HEAD request.


removeIntercepters

public void removeIntercepters(Class<?> intercepterClass)
Removes HTTP request execute intercepters of the given class or subclasses.

Parameters:
intercepterClass - intercepter class


Copyright © 2010 Google. All Rights Reserved.