Class AcmeJsonResource

java.lang.Object
org.shredzone.acme4j.AcmeResource
org.shredzone.acme4j.AcmeJsonResource
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Account, Authorization, Challenge, Order

public abstract class AcmeJsonResource extends AcmeResource
An ACME resource that stores its state in a JSON structure.
See Also:
  • Constructor Details

  • Method Details

    • getJSON

      public JSON getJSON()
      Returns the JSON representation of the resource data.

      If there is no data, update() 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.
    • setJSON

      protected void setJSON(JSON data)
      Sets the JSON representation of the resource data.
      Parameters:
      data - New JSON data, must not be null.
    • isValid

      protected boolean isValid()
      Checks if this resource is valid.
      Returns:
      true if the resource state has been loaded from the server. If false, getJSON() would implicitly call update() to fetch the current state from the server.
    • invalidate

      protected void invalidate()
      Invalidates the state of this resource. Enforces an update() when getJSON() is invoked.
    • update

      public void update() throws AcmeException
      Updates this resource, by fetching the current resource data from the server.
      Throws:
      AcmeException - if the resource could not be fetched.
      AcmeRetryAfterException - the resource is still being processed, and the server returned an estimated date when the process will be completed. If you are polling for the resource to complete, you should wait for the date given in AcmeRetryAfterException.getRetryAfter(). Note that the status of the resource is updated even if this exception was thrown.