public final class NetHttpTransport extends HttpTransport
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 URLConnection.setDefaultUseCaches(boolean)
.
Implementation is thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.
Modifier and Type | Class and Description |
---|---|
static class |
NetHttpTransport.Builder
Builder for
NetHttpTransport . |
Constructor and Description |
---|
NetHttpTransport()
Constructor with the default behavior.
|
Modifier and Type | Method and 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 |
isMtls()
Returns whether the transport is mTLS.
|
boolean |
supportsMethod(String method)
Returns whether a specified HTTP method is supported by this transport.
|
createRequestFactory, createRequestFactory, shutdown
public NetHttpTransport()
Instead use NetHttpTransport.Builder
to modify behavior.
public boolean supportsMethod(String method)
HttpTransport
Default implementation returns true if and only if the request method is "DELETE"
,
"GET"
, "POST"
, or "PUT"
. Subclasses should override.
supportsMethod
in class HttpTransport
method
- HTTP methodpublic boolean isMtls()
HttpTransport
isMtls
in class HttpTransport
protected com.google.api.client.http.javanet.NetHttpRequest buildRequest(String method, String url) throws IOException
HttpTransport
buildRequest
in class HttpTransport
method
- HTTP methodurl
- URLIOException
Copyright © 2011–2022 Google. All rights reserved.