Changeset 14592

Show
Ignore:
Timestamp:
28.09.2007 11:12:24 (12 years ago)
Author:
qq6
Message:

removed the connection check, because it doesn't work on applet

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/greenstone3/ServletConfiguration.java

    r14538 r14592  
    4040import java.io.*; 
    4141import java.lang.ref.*; 
    42 import java.lang.Thread; 
    4342import java.net.*; 
    4443import java.util.*; 
     
    6665    private HashMap mappings = null; 
    6766 
    68     public ServletConfiguration(String gsdl3_path) throws InterruptedException { 
     67    public ServletConfiguration(String gsdl3_path) { 
    6968     
    7069    this.gsdl3_path = gsdl3_path; 
    7170 
    7271    if (Gatherer.isGsdlRemote){ 
    73         // if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) { 
    74         //System.err.println("Error: Could not download web.xml."); 
    75         //System.exit(0); 
    76         //} 
    77         System.out.println("Starting download web.xml."); 
    78         long startTime = System.currentTimeMillis(); 
    79         long patience = 1000 * 10; 
    80         Thread t = new Thread(new downloadWebXMl()); 
    81         t.start(); 
    82  
    83         System.out.println("Waiting for download thread to finish"); 
    84         while (t.isAlive()) { 
    85         System.out.println("Still waiting..."); 
    86         //Wait maximum of 1 second for MessageLoop thread to 
    87             //finish. 
    88         t.join(1000); 
    89         if (((System.currentTimeMillis() - startTime) > patience) && 
    90                     t.isAlive()) { 
    91             //t.interrupt(); 
    92             //Shouldn't be long now -- wait indefinitely 
    93             //t.join(); 
    94             System.out.print("Have been waiting 10 seconds for connecting to the server, do you want to terminate the connection?(y/n)"); 
    95             BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
    96             try { 
    97             if (br.readLine().toLowerCase().startsWith("y")){ 
    98                  System.out.println("Terminate the connection! "); 
    99                  System.exit(0); 
    100             }else{ 
    101                 startTime = System.currentTimeMillis(); 
    102             }; 
    103             } catch (IOException ioe) { 
    104             System.out.println("IO error trying to read your answer!"); 
    105             System.exit(1); 
    106             } 
    107         } 
     72        if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) { 
     73        System.err.println("Error: Could not download web.xml."); 
     74        System.exit(0); 
    10875        } 
    109         System.out.println("The web.xml file has been downloaded"); 
    11076    } 
    111      
    11277    //String web_xml_path = gsdl3_path + File.separator + "web" + File.separator + "WEB-INF"+ File.separator + "web.xml"; 
    11378    File web_xml; 
     
    219184    return site; 
    220185    } 
    221  
    222     private static class downloadWebXMl implements Runnable { 
    223     public void run() { 
    224         if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) { 
    225         System.err.println("Error: Could not download web.xml."); 
    226         System.exit(0); 
    227         } 
    228     } 
    229     } 
    230  
    231186}