public interface Connection extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
int |
accept(int... httpStatus)
Checks if the HTTP response status is in the given list of acceptable HTTP states,
otherwise raises an
AcmeException matching the error. |
void |
close()
Closes the
Connection, releasing all resources. |
URL |
getLink(String relation)
Gets a relation link from the header.
|
URI |
getLinkAsURI(String relation)
Gets a relation link from the header.
|
URL |
getLocation()
Gets a location from the
Location header. |
void |
handleRetryAfter(String message)
Throws an
AcmeRetryAfterException if the last status was HTTP Accepted and
a Retry-After header was received. |
X509Certificate |
readCertificate()
Reads a certificate.
|
JSON |
readJsonResponse()
Reads a server response as JSON data.
|
void |
sendRequest(URL url,
Session session)
Sends a simple GET request.
|
void |
sendSignedRequest(URL url,
JSONBuilder claims,
Session session)
Sends a signed POST request.
|
void |
updateSession(Session session)
Updates a
Session by evaluating the HTTP response header. |
void sendRequest(URL url, Session session) throws AcmeException
url - URL to send the request to.session - Session instance to be used for trackingAcmeExceptionvoid sendSignedRequest(URL url, JSONBuilder claims, Session session) throws AcmeException
url - URL to send the request to.claims - JSONBuilder containing claims. Must not be null.session - Session instance to be used for signing and trackingAcmeExceptionint accept(int... httpStatus) throws AcmeException
AcmeException matching the error.httpStatus - Acceptable HTTP statesAcmeExceptionJSON readJsonResponse() throws AcmeException
AcmeExceptionX509Certificate readCertificate() throws AcmeException
X509Certificate that was read.AcmeExceptionvoid handleRetryAfter(String message) throws AcmeException
AcmeRetryAfterException if the last status was HTTP Accepted and
a Retry-After header was received.message - Message to be sent along with the AcmeRetryAfterExceptionAcmeExceptionvoid updateSession(Session session)
Session by evaluating the HTTP response header.session - Session instance to be updatedURL getLocation()
Location header.
Relative links are resolved against the last request's URL.
URL, or null if no Location header was setURL getLink(String relation)
Relative links are resolved against the last request's URL. If there is more than one relation, the first one is returned.
relation - Link relationURL, or null if there was no such relation linkURI getLinkAsURI(String relation)
Relative links are resolved against the last request's URL. If there is more than one relation, the first one is returned.
relation - Link relationURI, or null if there was no such relation linkvoid close()
Connection, releasing all resources.close in interface AutoCloseableCopyright © 2015–2019. All rights reserved.