Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class Web
- Object
- 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 types
class Web.Result | An outbound response: status, body, and libcurl’s message when it failed. |
Methods
Inherited methods
Method details
get
public static Web.Result get(String url)
throws IOExceptionThrows
getJson
public static Web.Result getJson(String url, String bearerToken)
throws IOExceptionThrows
postJson
public static Web.Result postJson(String url, String json, String bearerToken)
throws IOExceptionThrows
request
public static Web.Result request(String method, String url, List headers, byte[] body)
throws IOExceptionheaders: a list of “Name: value” strings, or null