01: //
02: // Copyright 01/30/01 Sun Microsystems, Inc. All Rights Reserved.
03: //
04: package com.sun.portal.netlet.client.applet;
05:
06: public class AppleBrowserProxyInfo {
07: private static final String sccsID = "@(#)AppleBrowserProxyInfo.java 1.1 01/01/30 Sun Microsystems, Inc.";
08:
09: private String proxyHost = null;
10: private int proxyPort = 0;
11: private boolean useProxy = false;
12: private boolean needWarning = false;
13:
14: public AppleBrowserProxyInfo() {
15:
16: try {
17: // need a javakey signed JAR file for getProperty() calls to work
18: proxyHost = System.getProperty("proxyHost");
19: String nonProxy = null;
20: if (proxyHost != null && proxyHost.length() > 0) {
21: useProxy = true;
22: proxyPort = Integer.parseInt(System
23: .getProperty("proxyPort"));
24: nonProxy = System.getProperty("http.nonProxyHosts");
25: }
26: // MSIE returns 0 for proxyPort, have to get it from user
27: if (useProxy) {
28: if (nonProxy == null
29: || nonProxy.indexOf("localhost") == -1
30: || nonProxy.indexOf("127.0.0.1") == -1) {
31: needWarning = true;
32: }
33: }
34:
35: } catch (NullPointerException ne) {
36: System.out.println("Netlet MRJ no proxy");
37: useProxy = false;
38: proxyHost = null;
39: proxyPort = 0;
40: } catch (Exception e) {
41: System.out
42: .println("Netlet MRJ Exception getting proxy info:"
43: + e);
44: useProxy = false;
45: proxyHost = null;
46: proxyPort = 0;
47: }
48: if (useProxy)
49: System.out.println("Netlet Got MRJ proxy:" + proxyHost
50: + " on port:" + proxyPort);
51:
52: }
53:
54: public boolean needProxyWarning() {
55: return needWarning;
56: }
57:
58: public boolean getProxyMode() {
59: return useProxy;
60: }
61:
62: public String getProxyHost() {
63: return (proxyHost);
64: }
65:
66: public int getProxyPort() {
67: return (proxyPort);
68: }
69:
70: }
|