private static String getProblemMessage(JsonObject jsonResponse) { String type = getOptionalJsonString(jsonResponse, TYPE); String detail = getOptionalJsonString(jsonResponse, DETAIL); String title = getOptionalJsonString(jsonResponse, TITLE); String problemMessage = null; if (detail != null) { problemMessage = detail; } else if (title != null) { problemMessage = title; } else if (type != null) { problemMessage = type; } return problemMessage; }
String type = getOptionalJsonString(jsonResponse, TYPE); if (type != null) { if (type.equals(BAD_NONCE)) { return; // the request will be re-attempted } else if (type.equals(USER_ACTION_REQUIRED)) { String instance = getOptionalJsonString(jsonResponse, INSTANCE); if (instance != null) { throw acme.userActionRequired(instance);
/** * Get the resource URLs needed to perform operations from the ACME server. * * @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 * @return a map of ACME resources to URLs * @throws AcmeException if an error occurs while attempting to get the resource URLs from the ACME server */ public Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); final Map<AcmeResource, URL> resourceUrls = account.getResourceUrls(staging); if (resourceUrls.isEmpty()) { HttpURLConnection connection = sendGetRequest(account.getServerUrl(staging), HttpURLConnection.HTTP_OK, JSON_CONTENT_TYPE); JsonObject directoryJson = getJsonResponse(connection); try { for (AcmeResource resource : AcmeResource.values()) { String resourceUrl = getOptionalJsonString(directoryJson, resource.getValue()); URL url = resourceUrl != null ? new URL(resourceUrl) : null; resourceUrls.put(resource, url); } } catch (MalformedURLException e) { throw acme.unableToRetrieveAcmeServerDirectoryUrls(e); } } return resourceUrls; }
String termsOfServiceUrl = getOptionalJsonString(metadata, TERMS_OF_SERVICE); if (termsOfServiceUrl != null) { metadataBuilder.setTermsOfServiceUrl(termsOfServiceUrl); String websiteUrl = getOptionalJsonString(metadata, WEBSITE); if (websiteUrl != null) { metadataBuilder.setWebsiteUrl(websiteUrl);
String certificateUrl = getOptionalJsonString(jsonResponse, CERTIFICATE); if (certificateUrl == null) { throw acme.noCertificateUrlProvidedByAcmeServer();
private static String getProblemMessage(JsonObject jsonResponse) { String type = getOptionalJsonString(jsonResponse, TYPE); String detail = getOptionalJsonString(jsonResponse, DETAIL); String title = getOptionalJsonString(jsonResponse, TITLE); String problemMessage = null; if (detail != null) { problemMessage = detail; } else if (title != null) { problemMessage = title; } else if (type != null) { problemMessage = type; } return problemMessage; }
private static String getProblemMessage(JsonObject jsonResponse) { String type = getOptionalJsonString(jsonResponse, TYPE); String detail = getOptionalJsonString(jsonResponse, DETAIL); String title = getOptionalJsonString(jsonResponse, TITLE); String problemMessage = null; if (detail != null) { problemMessage = detail; } else if (title != null) { problemMessage = title; } else if (type != null) { problemMessage = type; } return problemMessage; }
private static String getProblemMessage(JsonObject jsonResponse) { String type = getOptionalJsonString(jsonResponse, TYPE); String detail = getOptionalJsonString(jsonResponse, DETAIL); String title = getOptionalJsonString(jsonResponse, TITLE); String problemMessage = null; if (detail != null) { problemMessage = detail; } else if (title != null) { problemMessage = title; } else if (type != null) { problemMessage = type; } return problemMessage; }
String type = getOptionalJsonString(jsonResponse, TYPE); if (type != null) { if (type.equals(BAD_NONCE)) { return; // the request will be re-attempted } else if (type.equals(USER_ACTION_REQUIRED)) { String instance = getOptionalJsonString(jsonResponse, INSTANCE); if (instance != null) { throw acme.userActionRequired(instance);
String type = getOptionalJsonString(jsonResponse, TYPE); if (type != null) { if (type.equals(BAD_NONCE)) { return; // the request will be re-attempted } else if (type.equals(USER_ACTION_REQUIRED)) { String instance = getOptionalJsonString(jsonResponse, INSTANCE); if (instance != null) { throw acme.userActionRequired(instance);
String type = getOptionalJsonString(jsonResponse, TYPE); if (type != null) { if (type.equals(BAD_NONCE)) { return; // the request will be re-attempted } else if (type.equals(USER_ACTION_REQUIRED)) { String instance = getOptionalJsonString(jsonResponse, INSTANCE); if (instance != null) { throw acme.userActionRequired(instance);
/** * Get the resource URLs needed to perform operations from the ACME server. * * @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 * @return a map of ACME resources to URLs * @throws AcmeException if an error occurs while attempting to get the resource URLs from the ACME server */ public Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); final Map<AcmeResource, URL> resourceUrls = account.getResourceUrls(staging); if (resourceUrls.isEmpty()) { HttpURLConnection connection = sendGetRequest(account.getServerUrl(staging), HttpURLConnection.HTTP_OK, JSON_CONTENT_TYPE); JsonObject directoryJson = getJsonResponse(connection); try { for (AcmeResource resource : AcmeResource.values()) { String resourceUrl = getOptionalJsonString(directoryJson, resource.getValue()); URL url = resourceUrl != null ? new URL(resourceUrl) : null; resourceUrls.put(resource, url); } } catch (MalformedURLException e) { throw acme.unableToRetrieveAcmeServerDirectoryUrls(e); } } return resourceUrls; }
/** * Get the resource URLs needed to perform operations from the ACME server. * * @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 * @return a map of ACME resources to URLs * @throws AcmeException if an error occurs while attempting to get the resource URLs from the ACME server */ public Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); final Map<AcmeResource, URL> resourceUrls = account.getResourceUrls(staging); if (resourceUrls.isEmpty()) { HttpURLConnection connection = sendGetRequest(account.getServerUrl(staging), HttpURLConnection.HTTP_OK, JSON_CONTENT_TYPE); JsonObject directoryJson = getJsonResponse(connection); try { for (AcmeResource resource : AcmeResource.values()) { String resourceUrl = getOptionalJsonString(directoryJson, resource.getValue()); URL url = resourceUrl != null ? new URL(resourceUrl) : null; resourceUrls.put(resource, url); } } catch (MalformedURLException e) { throw acme.unableToRetrieveAcmeServerDirectoryUrls(e); } } return resourceUrls; }
/** * Get the resource URLs needed to perform operations from the ACME server. * * @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 * @return a map of ACME resources to URLs * @throws AcmeException if an error occurs while attempting to get the resource URLs from the ACME server */ public Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging) throws AcmeException { Assert.checkNotNullParam("account", account); final Map<AcmeResource, URL> resourceUrls = account.getResourceUrls(staging); if (resourceUrls.isEmpty()) { HttpURLConnection connection = sendGetRequest(account.getServerUrl(staging), HttpURLConnection.HTTP_OK, JSON_CONTENT_TYPE); JsonObject directoryJson = getJsonResponse(connection); try { for (AcmeResource resource : AcmeResource.values()) { String resourceUrl = getOptionalJsonString(directoryJson, resource.getValue()); URL url = resourceUrl != null ? new URL(resourceUrl) : null; resourceUrls.put(resource, url); } } catch (MalformedURLException e) { throw acme.unableToRetrieveAcmeServerDirectoryUrls(e); } } return resourceUrls; }
String termsOfServiceUrl = getOptionalJsonString(metadata, TERMS_OF_SERVICE); if (termsOfServiceUrl != null) { metadataBuilder.setTermsOfServiceUrl(termsOfServiceUrl); String websiteUrl = getOptionalJsonString(metadata, WEBSITE); if (websiteUrl != null) { metadataBuilder.setWebsiteUrl(websiteUrl);
String termsOfServiceUrl = getOptionalJsonString(metadata, TERMS_OF_SERVICE); if (termsOfServiceUrl != null) { metadataBuilder.setTermsOfServiceUrl(termsOfServiceUrl); String websiteUrl = getOptionalJsonString(metadata, WEBSITE); if (websiteUrl != null) { metadataBuilder.setWebsiteUrl(websiteUrl);
String termsOfServiceUrl = getOptionalJsonString(metadata, TERMS_OF_SERVICE); if (termsOfServiceUrl != null) { metadataBuilder.setTermsOfServiceUrl(termsOfServiceUrl); String websiteUrl = getOptionalJsonString(metadata, WEBSITE); if (websiteUrl != null) { metadataBuilder.setWebsiteUrl(websiteUrl);
String certificateUrl = getOptionalJsonString(jsonResponse, CERTIFICATE); if (certificateUrl == null) { throw acme.noCertificateUrlProvidedByAcmeServer();
String certificateUrl = getOptionalJsonString(jsonResponse, CERTIFICATE); if (certificateUrl == null) { throw acme.noCertificateUrlProvidedByAcmeServer();
String certificateUrl = getOptionalJsonString(jsonResponse, CERTIFICATE); if (certificateUrl == null) { throw acme.noCertificateUrlProvidedByAcmeServer();