}
public void run() {
try {
StringHandler sh = new StringHandler();
HttpClientRequest request = new HttpClientRequest();
request.setUrl(httpReqDef.getUrl());
request.setContentProvider(httpReqDef.getContentProvider());
request.setCredentialProvider(cp);
request.setContentHandler(sh);
request.execute();
if (request.getResponseInfo().getResponseCode() == HttpURLConnection.HTTP_OK) {
String strContent = Val.chkStr(sh.getContent());
Document docContent = null;
String contentType = Val.chkStr(request.getResponseInfo().getContentType());
try {
if (strContent.length() > 0 && (contentType.toLowerCase().contains("xml") || strContent.startsWith("<?xml"))) {
docContent = DomUtil.makeDomFromString(Val.removeBOM(strContent), false);
}
} catch (Exception ex) {
LOGGER.log(Level.FINER, "Error converting HTPP response into DOM.", ex);
}
array.onResponse(request.getResponseInfo(), strContent, docContent);
}
} catch (HttpClient401Exception ex) {
onUnauthorizedException();
} catch (IOException ex) {
LOGGER.log(Level.FINER, "Error submiting HTTP request.", ex);