Class NetHttpTransport (1.42.3)

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.

We honor the default global caching behavior. To change the default behavior use HttpURLConnection#setDefaultUseCaches(boolean).

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

Inheritance

java.lang.Object > HttpTransport > NetHttpTransport

Constructors

NetHttpTransport()

public NetHttpTransport()

Constructor with the default behavior.

Instead use Builder to modify behavior.

Methods

buildRequest(String method, String url)

protected NetHttpRequest buildRequest(String method, String url)

Builds a low level HTTP request for the given HTTP method.

Parameters
NameDescription
methodString
urlString
Returns
TypeDescription
com.google.api.client.http.javanet.NetHttpRequest
Overrides Exceptions
TypeDescription
IOException

isMtls()

public boolean isMtls()

Returns whether the transport is mTLS.

Returns
TypeDescription
boolean
Overrides

supportsMethod(String method)

public boolean supportsMethod(String method)

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.

Parameter
NameDescription
methodString
Returns
TypeDescription
boolean
Overrides