if (asyncSourceURI != null) {
final String URI = asyncSourceURI;
final Node transformTarget = target;
logger.log(Level.FINE, "Aynchronous GET for: " + asyncSourceURI);
final HTTPHandler hr = new HTTPHandler();
hr.doGet(asyncSourceURI, new RequestCallback() {
public void onError(Request request, Throwable exception) {
//hr.setErrorMessage(exception.getMessage());
String msg = "HTTP Error " + exception.getMessage() + " for URI " + URI;
handleException (new RuntimeException(msg), "onError");
}
public void onResponseReceived(Request request, Response response) {
int statusCode = response.getStatusCode();
if (statusCode == 200) {
Logger.getLogger("ResponseReceived").fine("GET Ok for: " + URI);
Node responseNode;
try {
responseNode = (Node)XMLDOM.parseXML(response.getText());
} catch(Exception e) {
handleException (new RuntimeException(e.getMessage()), "onResponseReceived");
return;
}
DocumentInfo responseDoc = config.wrapXMLDocument(responseNode, URI);
// now document is here, we can transform it
Node result = invokeTransform(responseDoc, transformTarget);
hr.setResultNode(result); // TODO: This isn't used yet
// handle OK response from the server
} else if (statusCode < 400) {
// transient
} else {
String msg = "HTTP Error " + statusCode + " " + response.getStatusText() + " for URI " + URI;