Class NetHttpTransport
- java.lang.Object
-
- com.google.api.client.http.HttpTransport
-
- com.google.api.client.http.javanet.NetHttpTransport
-
public final class NetHttpTransport extends HttpTransport
Thread-safe HTTP low-level transport based on thejava.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.We honor the default global caching behavior. To change the default behavior use
URLConnection.setDefaultUseCaches(boolean)
.Implementation is thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.
- Since:
- 1.0
- Author:
- Yaniv Inbar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NetHttpTransport.Builder
Builder forNetHttpTransport
.
-
Constructor Summary
Constructors Constructor Description NetHttpTransport()
Constructor with the default behavior.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.google.api.client.http.javanet.NetHttpRequest
buildRequest(String method, String url)
Builds a low level HTTP request for the given HTTP method.boolean
supportsMethod(String method)
Returns whether a specified HTTP method is supported by this transport.-
Methods inherited from class com.google.api.client.http.HttpTransport
createRequestFactory, createRequestFactory, shutdown
-
-
-
-
Constructor Detail
-
NetHttpTransport
public NetHttpTransport()
Constructor with the default behavior.Instead use
NetHttpTransport.Builder
to modify behavior.
-
-
Method Detail
-
supportsMethod
public boolean supportsMethod(String method)
Description copied from class:HttpTransport
Returns whether a specified HTTP method is supported by this transport.Default implementation returns true if and only if the request method is
"DELETE"
,"GET"
,"POST"
, or"PUT"
. Subclasses should override.- Overrides:
supportsMethod
in classHttpTransport
- Parameters:
method
- HTTP method
-
buildRequest
protected com.google.api.client.http.javanet.NetHttpRequest buildRequest(String method, String url) throws IOException
Description copied from class:HttpTransport
Builds a low level HTTP request for the given HTTP method.- Specified by:
buildRequest
in classHttpTransport
- Parameters:
method
- HTTP methodurl
- URL- Returns:
- new low level HTTP request
- Throws:
IOException
-
-