use of javax.ws.rs.ProcessingException in project admin-console-beta by connexta.
the class RequestUtils method executeGetRequest.
/**
* Executes a request by creating a Secure CXF Client from the provided url, credentials, and query params.
*
* Possible Error Codes to return
* - {@link org.codice.ddf.admin.common.report.message.DefaultMessages#CANNOT_CONNECT}
*
* @param clientUrl url to send GET request to
* @param creds optional basic authentication
* @param queryParams additional query parameters
* @return {@link Response} of the request
*/
public ReportWithResultImpl<Response> executeGetRequest(UrlField clientUrl, CredentialsField creds, Map<String, String> queryParams) {
WebClient client = generateClient(clientUrl.getValue(), creds, queryParams);
ReportWithResultImpl<Response> report = new ReportWithResultImpl<>();
Response response;
try {
response = client.get();
} catch (ProcessingException e) {
report.addResultMessage(cannotConnectError());
return report;
}
report.result(response);
return report;
}
Aggregations