Project

General

Profile

« Previous | Next » 

Revision 1606

Added by Jing Tao over 21 years ago

Revise getURLContent method and give up httpclient.

View differences:

src/edu/ucsb/nceas/metacat/MetacatReplication.java
57 57
    //the default deltaT can be set from metacat.properties
58 58
    //create a thread to do the delta-T check but don't execute it yet
59 59
    replicationDaemon = new Timer(true);
60
    java.net.URL.setURLStreamHandlerFactory(
60
    /*java.net.URL.setURLStreamHandlerFactory(
61 61
       new java.net.URLStreamHandlerFactory()
62 62
       {
63 63
          public java.net.URLStreamHandler createURLStreamHandler(
......
95 95
              }
96 96
              return null;
97 97
         }//createURLStreamHandler
98
     });
98
     });*/
99 99
    
100 100
  }
101 101
  
......
1629 1629
   */
1630 1630
  public static String getURLContent(URL u) throws java.io.IOException
1631 1631
  {
1632
    //System.out.println("url: " + u.toString());
1633 1632
    char istreamChar;
1634 1633
    int istreamInt;
1635
    InputStreamReader istream = new InputStreamReader(u.openStream());
1634
    MetaCatUtil.debugMessage("Before open the stream"+u.toString(), 50);
1635
    InputStream input = u.openStream();
1636
    MetaCatUtil.debugMessage("Afetr open the stream"+u.toString(), 50);
1637
    InputStreamReader istream = new InputStreamReader(input);
1636 1638
    StringBuffer serverResponse = new StringBuffer();
1637 1639
    while((istreamInt = istream.read()) != -1)
1638 1640
    {
1639 1641
      istreamChar = (char)istreamInt;
1640 1642
      serverResponse.append(istreamChar);
1641 1643
    }
1642
    
1644
    istream.close();
1645
    input.close();
1646
   
1643 1647
    return serverResponse.toString();
1644 1648
  }
1645 1649
  

Also available in: Unified diff