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, isShutdown, shutdownpublic NetHttpTransport()
Instead use NetHttpTransport.Builder to modify behavior.
public boolean supportsMethod(String method)
HttpTransportDefault implementation returns true if and only if the request method is "DELETE",
"GET", "POST", or "PUT". Subclasses should override.
supportsMethod in class HttpTransportmethod - HTTP methodpublic boolean isMtls()
HttpTransportisMtls in class HttpTransportprotected com.google.api.client.http.javanet.NetHttpRequest buildRequest(String method, String url) throws IOException
HttpTransportbuildRequest in class HttpTransportmethod - HTTP methodurl - URLIOExceptionCopyright © 2011–2025 Google. All rights reserved.