- Alle Superschnittstellen:
AutoCloseable
- Alle bekannten Implementierungsklassen:
DefaultConnection
The actual way of communicating with the ACME server is intentionally left open. Implementations could use other means than HTTP, or could mock the communication for unit testing.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclose()Closes theConnection, releasing all resources.Returns the expiration date of the resource, if present.Returns the content of the last-modified header, if present.Gets one or more relation links from the header.Gets a location from theLocationheader.getNonce()Gets the nonce from the nonce header.Returns the Retry-After header if present.default voidhandleRetryAfter(String message) Veraltet.Reads a certificate and its chain of issuers.Reads a server response as JSON object.voidresetNonce(Session session) Resets the session nonce, by fetching a new one.intsendCertificateRequest(URL url, Login login) Sends a signed POST-as-GET request for a certificate resource.intsendRequest(URL url, Session session, ZonedDateTime ifModifiedSince) Sends a simple GET request.intsendSignedPostAsGetRequest(URL url, Login login) Sends a signed POST-as-GET request.intsendSignedRequest(URL url, JSONBuilder claims, Login login) Sends a signed POST request.intsendSignedRequest(URL url, JSONBuilder claims, Session session, KeyPair keypair) Sends a signed POST request.
-
Methodendetails
-
resetNonce
Resets the session nonce, by fetching a new one.- Parameter:
session-Sessioninstance to fetch a nonce for- Löst aus:
AcmeException
-
sendRequest
int sendRequest(URL url, Session session, @Nullable ZonedDateTime ifModifiedSince) throws AcmeException Sends a simple GET request.If the response code was not HTTP status 200, an
AcmeExceptionmatching the error is raised.- Parameter:
url-URLto send the request to.session-Sessioninstance to be used for trackingifModifiedSince-ZonedDateTimeto be sent as "If-Modified-Since" header, ornullif this header is not to be used- Gibt zurück:
- HTTP status that was returned
- Löst aus:
AcmeException
-
sendCertificateRequest
Sends a signed POST-as-GET request for a certificate resource. Requires aLoginfor the session andKeyPair. TheLoginaccount location is sent in a "kid" protected header.If the server does not return a 200 class status code, an
AcmeExceptionis raised matching the error.- Parameter:
url-URLto send the request to.login-Logininstance to be used for signing and tracking.- Gibt zurück:
- HTTP 200 class status that was returned
- Löst aus:
AcmeException
-
sendSignedPostAsGetRequest
Sends a signed POST-as-GET request. Requires aLoginfor the session andKeyPair. TheLoginaccount location is sent in a "kid" protected header.If the server does not return a 200 class status code, an
AcmeExceptionis raised matching the error.- Parameter:
url-URLto send the request to.login-Logininstance to be used for signing and tracking.- Gibt zurück:
- HTTP 200 class status that was returned
- Löst aus:
AcmeException
-
sendSignedRequest
Sends a signed POST request. Requires aLoginfor the session andKeyPair. TheLoginaccount location is sent in a "kid" protected header.If the server does not return a 200 class status code, an
AcmeExceptionis raised matching the error.- Parameter:
url-URLto send the request to.claims-JSONBuildercontaining claims.login-Logininstance to be used for signing and tracking.- Gibt zurück:
- HTTP 200 class status that was returned
- Löst aus:
AcmeException
-
sendSignedRequest
int sendSignedRequest(URL url, JSONBuilder claims, Session session, KeyPair keypair) throws AcmeException Sends a signed POST request. Only requires aSession. TheKeyPairis sent in a "jwk" protected header field.If the server does not return a 200 class status code, an
AcmeExceptionis raised matching the error.- Parameter:
url-URLto send the request to.claims-JSONBuildercontaining claims.session-Sessioninstance to be used for tracking.keypair-KeyPairto be used for signing.- Gibt zurück:
- HTTP 200 class status that was returned
- Löst aus:
AcmeException
-
readJsonResponse
Reads a server response as JSON object.- Gibt zurück:
- The JSON response.
- Löst aus:
AcmeException
-
readCertificates
Reads a certificate and its chain of issuers.- Gibt zurück:
- List of X.509 certificate and chain that was read.
- Löst aus:
AcmeException
-
getRetryAfter
Returns the Retry-After header if present.- Seit:
- 3.0.0
-
handleRetryAfter
Veraltet.Prefer to usegetRetryAfter().Throws anAcmeRetryAfterExceptionif the last status was HTTP Accepted and a Retry-After header was received.- Parameter:
message- Message to be sent along with theAcmeRetryAfterException- Löst aus:
AcmeException
-
getNonce
Gets the nonce from the nonce header.- Gibt zurück:
- Base64 encoded nonce, or empty if no nonce header was set
-
getLocation
Gets a location from theLocationheader.Relative links are resolved against the last request's URL.
- Gibt zurück:
- Location
URL - Löst aus:
AcmeProtocolException- if the location header is missing
-
getLastModified
Returns the content of the last-modified header, if present.- Gibt zurück:
- Date in the Last-Modified header, or empty if the server did not provide this information.
- Seit:
- 2.10
-
getExpiration
Returns the expiration date of the resource, if present.- Gibt zurück:
- Expiration date, either from the Cache-Control or Expires header. If empty, the server did not provide an expiration date, or forbid caching.
- Seit:
- 2.10
-
getLinks
Gets one or more relation links from the header. The result is expected to be a URL.Relative links are resolved against the last request's URL.
- Parameter:
relation- Link relation- Gibt zurück:
- Collection of links. Empty if there was no such relation.
-
close
void close()Closes theConnection, releasing all resources.- Angegeben von:
closein SchnittstelleAutoCloseable
-
getRetryAfter().