-// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
package org.xwt;
import java.net.*;
OUTER: do {
if (pi != null) {
for(int i=0; i<pi.excluded.length; i++) if (host.equals(pi.excluded[i])) break OUTER;
- if (sock == null && pi.proxyAutoConfigJSFunction != null) sock = attemptPAC(pi.proxyAutoConfigJSFunction);
+ if (sock == null && pi.proxyAutoConfigFunction != null) sock = attemptPAC(pi.proxyAutoConfigFunction);
if (sock == null && ssl && pi.httpsProxyHost != null) sock = attemptHttpProxy(pi.httpsProxyHost,pi.httpsProxyPort);
if (sock == null && pi.httpProxyHost != null) sock = attemptHttpProxy(pi.httpProxyHost, pi.httpProxyPort);
if (sock == null && pi.socksProxyHost != null) sock = attemptSocksProxy(pi.socksProxyHost, pi.socksProxyPort);
public String socksProxyHost = null; ///< the SOCKS Proxy Host to use
public int socksProxyPort = -1; ///< the SOCKS Proxy Port to use
public String[] excluded = null; ///< hosts to be excluded from proxy use; wildcards permitted
- public JSFunction proxyAutoConfigJSFunction = null; ///< the PAC script
+ public JS proxyAutoConfigFunction = null; ///< the PAC script
public static Proxy detectProxyViaManual() {
Proxy ret = new Proxy();
return ret;
}
- public static JSScope proxyAutoConfigRootJSScope = new ProxyAutoConfigRootJSScope();
- public static JSFunction getProxyAutoConfigJSFunction(String url) {
+ public static JSScope proxyAutoConfigRootScope = new ProxyAutoConfigRootScope();
+ public static JS getProxyAutoConfigFunction(String url) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new HTTP(url, true).GET()));
String s = null;
if (Log.on) Log.info(Proxy.class, script);
}
- JSFunction scr = JSFunction.fromReader("PAC script at " + url, 0, new StringReader(script));
- scr.cloneWithNewParentScope(proxyAutoConfigRootJSScope).call(null, null, null, null, 0);
- return (JSFunction)proxyAutoConfigRootJSScope.get("FindProxyForURL");
+ JS scr = JS.fromReader("PAC script at " + url, 0, new StringReader(script));
+ JS.cloneWithNewParentScope(scr, proxyAutoConfigRootScope).call(null, null, null, null, 0);
+ return (JS)proxyAutoConfigRootScope.get("FindProxyForURL");
} catch (Exception e) {
if (Log.on) {
Log.info(Platform.class, "WPAD detection failed due to:");
Scheduler.add(new Scheduler.Task() {
public void perform() throws Exception {
Box b = new Box();
- Template t = Template.getTemplate((Stream)Main.builtin.get("org/xwt/builtin/proxy_authorization.xwt"));
- t.apply(b, null);
+ Template t = new Template(Stream.getInputStream((JS)Main.builtin.get("org/xwt/builtin/proxy_authorization.xwt")), new XWT(null));
+ t.apply(b);
b.put("realm", realm);
b.put("proxyIP", proxyIP);
}
// ProxyAutoConfigRootJSScope ////////////////////////////////////////////////////////////////////
- public static class ProxyAutoConfigRootJSScope extends JSScope.Global {
+ public static class ProxyAutoConfigRootScope extends JSScope.Global {
- public ProxyAutoConfigRootJSScope() { super(); }
+ public ProxyAutoConfigRootScope() { super(); }
public Object get(Object name) throws JSExn {
//#switch(name)