private Document fetchResult(URL cgiUrl){
  try {
    DocumentBuilderFactory docBuilderFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder=docBuilderFactory.newDocumentBuilder();
    URLConnection URLconnection=cgiUrl.openConnection();
    HttpURLConnection httpConnection=(HttpURLConnection)URLconnection;
    int responseCode=httpConnection.getResponseCode();
    if (responseCode == HttpURLConnection.HTTP_OK) {
      InputStream inStream=httpConnection.getInputStream();
      try {
        Document doc=docBuilder.parse(inStream);
        return doc;
      }
 catch (      org.xml.sax.SAXException e) {
        log.log(Level.SEVERE,"Fetch Result: " + e.getMessage());
        e.printStackTrace();
      }
    }
  }
 catch (  Exception e) {
    log.log(Level.SEVERE,"Fetch Result: " + e.getMessage());
    e.printStackTrace();
  }
  return null;
}

private Document fetchResult ( URL cgiUrl ) { try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder docBuilder = docBuilderFactory . newDocumentBuilder ( ) ; URLConnection URLconnection = cgiUrl . openConnection ( ) ; HttpURLConnection httpConnection = ( HttpURLConnection ) URLconnection ; int responseCode = httpConnection . getResponseCode ( ) ; if ( responseCode == HttpURLConnection . HTTP_OK ) { InputStream inStream = httpConnection . getInputStream ( ) ; try { Document doc = docBuilder . parse ( inStream ) ; return doc ; } catch ( org . xml . sax . SAXException e ) { log . log ( Level . SEVERE , "Fetch Result: " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } } } catch ( Exception e ) { log . log ( Level . SEVERE , "Fetch Result: " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } return null ; }
fetch the lookup result from server .
