com.google.api.client.http.javanet
Class NetHttpTransport

java.lang.Object
  extended by com.google.api.client.http.HttpTransport
      extended by com.google.api.client.http.javanet.NetHttpTransport

public final class NetHttpTransport
extends HttpTransport

Thread-safe HTTP low-level transport based on the java.net package.

Users should consider modifying the keep alive property on NetHttpTransport to control whether the socket should be returned to a pool of connected sockets. More information is available here.

Implementation is thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.

Upgrade warning: in prior version 1.10 when using GET method with non-zero content, it automatically changed the method to POST. However, starting with version 1.11 it now throws an IllegalArgumentException instead. Instead, use POST.

Since:
1.0
Author:
Yaniv Inbar

Constructor Summary
NetHttpTransport()
           
 
Method Summary
 com.google.api.client.http.javanet.NetHttpRequest buildDeleteRequest(String url)
          Builds a DELETE request.
 com.google.api.client.http.javanet.NetHttpRequest buildGetRequest(String url)
          Builds a GET request.
 com.google.api.client.http.javanet.NetHttpRequest buildHeadRequest(String url)
          Builds a HEAD request.
 com.google.api.client.http.javanet.NetHttpRequest buildPostRequest(String url)
          Builds a POST request.
 com.google.api.client.http.javanet.NetHttpRequest buildPutRequest(String url)
          Builds a PUT request.
 boolean supportsHead()
          Returns whether this HTTP transport implementation supports the HEAD request method.
 
Methods inherited from class com.google.api.client.http.HttpTransport
buildPatchRequest, createRequestFactory, createRequestFactory, shutdown, supportsPatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetHttpTransport

public NetHttpTransport()
Method Detail

supportsHead

public boolean supportsHead()
Description copied from class: HttpTransport
Returns whether this HTTP transport implementation supports the HEAD request method.

Default implementation returns false.

Overrides:
supportsHead in class HttpTransport

buildDeleteRequest

public com.google.api.client.http.javanet.NetHttpRequest buildDeleteRequest(String url)
                                                                     throws IOException
Description copied from class: HttpTransport
Builds a DELETE request.

Specified by:
buildDeleteRequest in class HttpTransport
Parameters:
url - URL
Throws:
IOException - I/O exception

buildGetRequest

public com.google.api.client.http.javanet.NetHttpRequest buildGetRequest(String url)
                                                                  throws IOException
Description copied from class: HttpTransport
Builds a GET request.

Specified by:
buildGetRequest in class HttpTransport
Parameters:
url - URL
Throws:
IOException - I/O exception

buildHeadRequest

public com.google.api.client.http.javanet.NetHttpRequest buildHeadRequest(String url)
                                                                   throws IOException
Description copied from class: HttpTransport
Builds a HEAD request. Won't be called if HttpTransport.supportsHead() returns false .

Default implementation throws an UnsupportedOperationException.

Overrides:
buildHeadRequest in class HttpTransport
Parameters:
url - URL
Throws:
IOException - I/O exception

buildPostRequest

public com.google.api.client.http.javanet.NetHttpRequest buildPostRequest(String url)
                                                                   throws IOException
Description copied from class: HttpTransport
Builds a POST request.

Specified by:
buildPostRequest in class HttpTransport
Parameters:
url - URL
Throws:
IOException - I/O exception

buildPutRequest

public com.google.api.client.http.javanet.NetHttpRequest buildPutRequest(String url)
                                                                  throws IOException
Description copied from class: HttpTransport
Builds a PUT request.

Specified by:
buildPutRequest in class HttpTransport
Parameters:
url - URL
Throws:
IOException - I/O exception


Copyright © 2011-2012 Google. All Rights Reserved.