java.lang.Object
org.shredzone.acme4j.Session
A session stores the ACME server URI. It also tracks communication parameters.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconnect()Returns a newConnectionto the ACME server.Returns the date when the current directory records will expire.Returns the date when the directory has been modified the last time.Gets the current locale of this session.Gets the metadata of the provider's directory.getNonce()Gets the last base64 encoded nonce, ornullif the session is new.getProxy()Deprecated.Gets the ACME serverURIof this session.booleanReturnstrueif a directory is available.Logs into an existing account.Returns the currentNetworkSettings.provider()Returns theAcmeProviderthat is used for this session.resourceUrl(Resource resource) voidsetDirectoryExpires(ZonedDateTime directoryExpires) Sets the date when the current directory will expire.voidsetDirectoryLastModified(ZonedDateTime directoryLastModified) Sets the date when the directory has been modified the last time.voidSets the locale used in this session.voidSets the base64 encoded nonce received by the server.voidDeprecated.UsenetworkSettings().setProxy(Proxy)
-
Field Details
-
directoryLastModified
-
directoryExpires
-
-
Constructor Details
-
Session
Creates a newSession.- Parameters:
serverUri- URI string of the ACME server
-
Session
Creates a newSession.- Parameters:
serverUri-URIof the ACME server- Throws:
IllegalArgumentException- if no ACME provider was found for the server URI.
-
Session
Creates a newSessionusing the givenAcmeProvider.This constructor should only be used for testing purposes.
- Parameters:
serverUri-URIof the ACME serverprovider-AcmeProviderto be used- Since:
- 2.8
-
-
Method Details
-
login
Logs into an existing account. -
getServerUri
Gets the ACME serverURIof this session. -
getNonce
Gets the last base64 encoded nonce, ornullif the session is new. -
setNonce
Sets the base64 encoded nonce received by the server. -
getLocale
Gets the current locale of this session. -
setLocale
Sets the locale used in this session. The locale is passed to the server as Accept-Language header. The server may respond with localized messages. -
getProxy
Deprecated.UsenetworkSettings().getProxy()Gets theProxyto be used for connections. -
setProxy
Deprecated.UsenetworkSettings().setProxy(Proxy)Sets aProxythat is to be used for all connections. Ifnull,Proxy.NO_PROXYis used, which is also the default. -
networkSettings
Returns the currentNetworkSettings.- Returns:
NetworkSettings- Since:
- 2.8
-
provider
Returns theAcmeProviderthat is used for this session.- Returns:
AcmeProvider
-
connect
Returns a newConnectionto the ACME server.- Returns:
Connection
-
resourceUrl
Gets theURLof the givenResource. This may involve connecting to the server and getting a directory. The result is cached.- Parameters:
resource-Resourceto get theURLof- Returns:
URLof the resource- Throws:
AcmeException- if the server does not offer theResource
-
getMetadata
Gets the metadata of the provider's directory. This may involve connecting to the server and getting a directory. The result is cached.- Returns:
Metadata. May contain no data, but is nevernull.- Throws:
AcmeException
-
getDirectoryLastModified
Returns the date when the directory has been modified the last time.- Returns:
- The last modification date of the directory, or
nullif unknown (directory has not been read yet or did not provide this information). - Since:
- 2.10
-
setDirectoryLastModified
Sets the date when the directory has been modified the last time. Should only be invoked byAcmeProviderimplementations.- Parameters:
directoryLastModified- The last modification date of the directory, ornullif unknown (directory has not been read yet or did not provide this information).- Since:
- 2.10
-
getDirectoryExpires
Returns the date when the current directory records will expire. A fresh copy of the directory will be fetched automatically after that instant.- Returns:
- The expiration date, or
nullif the server did not provide this information. - Since:
- 2.10
-
setDirectoryExpires
Sets the date when the current directory will expire. Should only be invoked byAcmeProviderimplementations.- Parameters:
directoryExpires- Expiration date, ornullif the server did not provide this information.- Since:
- 2.10
-
hasDirectory
Returnstrueif a directory is available. Should only be invoked byAcmeProviderimplementations.- Returns:
trueif a directory is available.- Since:
- 2.10
-
networkSettings().getProxy()