/** * Update an account with an ACME server using the given account information. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param termsOfServiceAgreed the new value for whether or not the terms of service have been agreed to * @param contactUrls the new account contact URLs * @throws AcmeException if an error occurs while attempting to update the account */ public void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls) throws AcmeException { Assert.checkNotNullParam("account", account); JsonObjectBuilder payloadBuilder = Json.createObjectBuilder() .add(TERMS_OF_SERVICE_AGREED, termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { JsonArrayBuilder contactBuilder = Json.createArrayBuilder(); for (String contactUrl : contactUrls) { contactBuilder.add(contactUrl); } payloadBuilder.add(CONTACT, contactBuilder.build()); } sendPostRequestWithRetries(account, staging, getAccountUrl(account, staging), false, getEncodedJson(payloadBuilder.build()), HttpURLConnection.HTTP_OK); account.setTermsOfServiceAgreed(termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { account.setContactUrls(contactUrls); } }
/** * Update an account with an ACME server using the given account information. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param termsOfServiceAgreed the new value for whether or not the terms of service have been agreed to * @param contactUrls the new account contact URLs * @throws AcmeException if an error occurs while attempting to update the account */ public void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls) throws AcmeException { Assert.checkNotNullParam("account", account); JsonObjectBuilder payloadBuilder = Json.createObjectBuilder() .add(TERMS_OF_SERVICE_AGREED, termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { JsonArrayBuilder contactBuilder = Json.createArrayBuilder(); for (String contactUrl : contactUrls) { contactBuilder.add(contactUrl); } payloadBuilder.add(CONTACT, contactBuilder.build()); } sendPostRequestWithRetries(account, staging, getAccountUrl(account, staging), false, getEncodedJson(payloadBuilder.build()), HttpURLConnection.HTTP_OK); account.setTermsOfServiceAgreed(termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { account.setContactUrls(contactUrls); } }
/** * Update an account with an ACME server using the given account information. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param termsOfServiceAgreed the new value for whether or not the terms of service have been agreed to * @param contactUrls the new account contact URLs * @throws AcmeException if an error occurs while attempting to update the account */ public void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls) throws AcmeException { Assert.checkNotNullParam("account", account); JsonObjectBuilder payloadBuilder = Json.createObjectBuilder() .add(TERMS_OF_SERVICE_AGREED, termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { JsonArrayBuilder contactBuilder = Json.createArrayBuilder(); for (String contactUrl : contactUrls) { contactBuilder.add(contactUrl); } payloadBuilder.add(CONTACT, contactBuilder.build()); } sendPostRequestWithRetries(account, staging, getAccountUrl(account, staging), false, getEncodedJson(payloadBuilder.build()), HttpURLConnection.HTTP_OK); account.setTermsOfServiceAgreed(termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { account.setContactUrls(contactUrls); } }
/** * Update an account with an ACME server using the given account information. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param termsOfServiceAgreed the new value for whether or not the terms of service have been agreed to * @param contactUrls the new account contact URLs * @throws AcmeException if an error occurs while attempting to update the account */ public void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls) throws AcmeException { Assert.checkNotNullParam("account", account); JsonObjectBuilder payloadBuilder = Json.createObjectBuilder() .add(TERMS_OF_SERVICE_AGREED, termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { JsonArrayBuilder contactBuilder = Json.createArrayBuilder(); for (String contactUrl : contactUrls) { contactBuilder.add(contactUrl); } payloadBuilder.add(CONTACT, contactBuilder.build()); } sendPostRequestWithRetries(account, staging, getAccountUrl(account, staging), false, getEncodedJson(payloadBuilder.build()), HttpURLConnection.HTTP_OK); account.setTermsOfServiceAgreed(termsOfServiceAgreed); if (contactUrls != null && ! (contactUrls.length == 0)) { account.setContactUrls(contactUrls); } }