Class Web
Outbound HTTP and HTTPS for server-side binaries. Backed by libcurl, so TLS verification, redirects, chunked decoding and the system certificate store all come from a library that is maintained for the purpose.
Distinct from Http, which is a raw-socket plaintext client for the host
runtime's loopback control protocol. Use this one for anything real.
Certificate store. A dynamically linked build finds the system CA bundle.
A fully static build has whatever the image provides, which for a scratch
container is nothing - and TLS then fails with "unable to get local issuer
certificate". Ship a ca-certificates.crt and point curl at it with the
CURL_CA_BUNDLE or SSL_CERT_FILE environment variable; both are read by
libcurl itself, so no code here has to know about it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn outbound response: status, body, and libcurl's message when it failed. -
Method Summary
Modifier and TypeMethodDescriptionstatic Web.Resultstatic Web.Resultstatic Web.Resultstatic Web.Resultheaders: a list of "Name: value" strings, or null
-
Method Details
-
get
- Throws:
IOException
-
getJson
- Throws:
IOException
-
postJson
- Throws:
IOException
-
request
public static Web.Result request(String method, String url, List headers, byte[] body) throws IOException headers: a list of "Name: value" strings, or null
- Throws:
IOException
-