Changeset 5226
- Timestamp:
- 2003-08-20T16:10:44+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r5112 r5226 38 38 import java.io.Reader; 39 39 import java.io.StringReader; 40 import java.net.Authenticator; 41 import java.net.PasswordAuthentication; 40 42 41 43 /** … … 148 150 this.site_http_address = http_address.getAttribute(GSXML.VALUE_ATT); 149 151 } 150 152 153 Element proxy = (Element)GSXML.getChildByTagName(config, "proxy"); 154 if (proxy != null) { 155 String host = proxy.getAttribute("host"); 156 String port = proxy.getAttribute("port"); 157 final String user = proxy.getAttribute("user"); 158 final String passwd = proxy.getAttribute("password"); 159 if (host.equals("") || port.equals("") || user.equals("")||passwd.equals("")) { 160 System.err.println("MessageRouter.configure Error: A proxy was specified in the config file, but attributes host, port, user, password were not all present"); 161 } else { 162 try { 163 // set up the proxy 164 System.setProperty("http.proxyType", "4"); 165 System.setProperty("http.proxyHost", host); 166 System.setProperty("http.proxyPort", port); 167 System.setProperty("http.proxySet", "true"); 168 Authenticator.setDefault(new Authenticator(){ 169 protected PasswordAuthentication getPasswordAuthentication(){ 170 return new PasswordAuthentication(user, new 171 String(passwd).toCharArray()); 172 } 173 }); 174 175 } catch (Exception e) { 176 System.err.println("MessageRouter Error: couldn't set up the proxy"); 177 } 178 } 179 } 180 151 181 // load up the services 152 182 Element service_rack_list = (Element)GSXML.getChildByTagName(config, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER); … … 845 875 } 846 876 } 847 848 877 849 878 }
Note:
See TracChangeset
for help on using the changeset viewer.