java.lang.Object
org.shredzone.acme4j.AcmeResource
org.shredzone.acme4j.AcmeJsonResource
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Account,Authorization,Challenge,Order,RenewalInfo
An extension of
AcmeResource that also contains the current state of a resource
as JSON document. If the current state is not present, this class takes care of
fetching it from the server if necessary.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAcmeJsonResource(Login login, URL location) Create a newAcmeJsonResource. -
Method Summary
Modifier and TypeMethodDescriptionfetch()Updates this resource, by fetching the current resource data from the server.getJSON()Returns the JSON representation of the resource data.Gets an estimation when the resource status will change.protected voidInvalidates the state of this resource.protected booleanisValid()Checks if this resource is valid.protected voidSets the JSON representation of the resource data.protected voidsetRetryAfter(Instant retryAfter) Sets a Retry-After instant.Methods inherited from class org.shredzone.acme4j.AcmeResource
finalize, getLocation, getLogin, getSession, rebind
-
Constructor Details
-
AcmeJsonResource
Create a newAcmeJsonResource.
-
-
Method Details
-
getJSON
Returns the JSON representation of the resource data.If there is no data,
fetch()is invoked to fetch it from the server.This method can be used to read proprietary data from the resources.
- Returns:
- Resource data, as
JSON. - Throws:
AcmeLazyLoadingException- if anAcmeExceptionoccured while fetching the current state from the server.
-
setJSON
Sets the JSON representation of the resource data.- Parameters:
data- NewJSONdata, must not benull.
-
isValid
Checks if this resource is valid. -
invalidate
-
fetch
Updates this resource, by fetching the current resource data from the server.- Returns:
- An
Optionalestimation when the resource status will change. If you are polling for the resource to complete, you should wait for the given instant before trying again. Empty if the server did not return a "Retry-After" header. - Throws:
AcmeException- if the resource could not be fetched.- Since:
- 3.2.0
-
setRetryAfter
Sets a Retry-After instant.- Since:
- 3.2.0
-
getRetryAfter
Gets an estimation when the resource status will change. If you are polling for the resource to complete, you should wait for the given instant before trying a status refresh.This instant was sent with the Retry-After header at the last update.
- Returns:
- Retry-after
Instant, or empty if there was no such header. - Since:
- 3.2.0
-