com.google.api.client.http
Class HttpRequest

java.lang.Object
  extended by com.google.api.client.http.HttpRequest

public final class HttpRequest
extends Object

HTTP request.

Since:
1.0
Author:
Yaniv Inbar

Field Summary
 HttpContent content
          HTTP request content or null for none.
 boolean disableContentLogging
          Whether to disable request content logging during execute() (unless Level.ALL is loggable which forces all logging).
 HttpHeaders headers
          HTTP request headers.
 String method
          HTTP request method.
 HttpTransport transport
          HTTP transport.
 GenericUrl url
          HTTP request URL.
 
Method Summary
 HttpResponse execute()
          Execute the HTTP request and returns the HTTP response.
 void setUrl(String encodedUrl)
          Sets the url based on the given encoded URL string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

headers

public HttpHeaders headers
HTTP request headers.

Its value is initialized by calling clone() on the HttpTransport.defaultHeaders. Therefore, it is initialized to be of the same Java class, i.e. of the same Object.getClass().


disableContentLogging

public boolean disableContentLogging
Whether to disable request content logging during execute() (unless Level.ALL is loggable which forces all logging).

Useful for example if content has sensitive data such as an authentication information. Defaults to false.


content

public HttpContent content
HTTP request content or null for none.


transport

public final HttpTransport transport
HTTP transport.


method

public String method
HTTP request method.


url

public GenericUrl url
HTTP request URL.

Method Detail

setUrl

public void setUrl(String encodedUrl)
Sets the url based on the given encoded URL string.


execute

public HttpResponse execute()
                     throws IOException
Execute the HTTP request and returns the HTTP response.

Note that regardless of the returned status code, the HTTP response content has not been parsed yet, and must be parsed by the calling code.

Almost all details of the request and response are logged if Level.CONFIG is loggable. The only exception is the value of the Authorization header which is only logged if Level.ALL is loggable.

Returns:
HTTP response for an HTTP success code
Throws:
HttpResponseException - for an HTTP error code
IOException
See Also:
HttpResponse.isSuccessStatusCode


Copyright © 2010 Google. All Rights Reserved.