record.setMetadataResourceURL(requestUrl);
hasResourceUrl = true;
}
if (!hasFullMetadata && !hasResourceUrl) {
throw new SearchException("Neither full metadata nor metadata"
+ " resource URL was found for the CSW record.");
} else if (hasResourceUrl) {
// need to load metadata from resource URL
URL url = null;
Exception ex = null;
try {
url = new URL(record.getMetadataResourceURL());
HttpClientRequest clientRequest = HttpClientRequest.newRequest(
HttpClientRequest.MethodName.GET, url.toExternalForm());
// clientRequest.setConnectionTimeOut(getConnectionTimeout());
//clientRequest.setResponseTimeOut(getResponseTimeout());
clientRequest.execute();
String response = clientRequest.readResponseAsCharacters();
LOG.finer("Response from get Metadata url = " + url.toExternalForm()
+"\n response = \n"+ response);
record.setFullMetadata(response);
} catch (MalformedURLException e) {
ex = e;
} catch (IOException e) {
ex = e;
}
if(ex != null) {
throw new SearchException("Could not get metadata id url = " + url, ex);
}
}