if (responseEntity != null) {
return;
}
HttpGet getMethod = new HttpGet(this.uri);
HttpResponse response;
try {
response = ((PreemptiveAuthHttpRequestFactory) SyncopeSession.get().getRestTemplate().getRequestFactory()).
getHttpClient().execute(getMethod);
} catch (Exception e) {
LOG.error("Unexpected exception while executing HTTP method to {}", this.uri, e);
response = buildFakeResponse(e.getMessage());
}
if (response.getStatusLine().getStatusCode() != 200) {
LOG.error("Unsuccessful HTTP method to {}", this.uri);
response = buildFakeResponse("HTTP status " + response.getStatusLine().getStatusCode());
}
responseEntity = response.getEntity();
Header[] headers = response.getHeaders("Content-Disposition");
if (headers != null && headers.length > 0) {
String value = headers[0].getValue();
String[] splitted = value.split("=");
if (splitted != null && splitted.length > 1) {
filename = splitted[1].trim();