Source Code Cross Referenced for httpRemoteProxyConfig.java in  » Search-Engine » yacy » de » anomic » http » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » yacy » de.anomic.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //httpRemoteProxyConfig.java 
002:        //-----------------------
003:        //part of the AnomicHTTPD caching proxy
004:        //(C) by Michael Peter Christen; mc@anomic.de
005:        //first published on http://www.anomic.de
006:        //Frankfurt, Germany, 2004
007:        //
008:        //this file was contributed by Martin Thelian
009:        //$LastChangedDate$ 
010:        //$LastChangedBy$
011:        //$LastChangedRevision$
012:        //
013:        //This program is free software; you can redistribute it and/or modify
014:        //it under the terms of the GNU General Public License as published by
015:        //the Free Software Foundation; either version 2 of the License, or
016:        //(at your option) any later version.
017:        //
018:        //This program is distributed in the hope that it will be useful,
019:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
020:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021:        //GNU General Public License for more details.
022:        //
023:        //You should have received a copy of the GNU General Public License
024:        //along with this program; if not, write to the Free Software
025:        //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026:        //
027:        //Using this software in any meaning (reading, learning, copying, compiling,
028:        //running) means that you agree that the Author(s) is (are) not responsible
029:        //for cost, loss of data or any harm that may be caused directly or indirectly
030:        //by usage of this softare or this documentation. The usage of this software
031:        //is on your own risk. The installation and usage (starting/running) of this
032:        //software may allow other people or application to access your computer and
033:        //any attached devices and is highly dependent on the configuration of the
034:        //software which must be done by the user of the software; the author(s) is
035:        //(are) also not responsible for proper configuration and usage of the
036:        //software, even if provoked by documentation provided together with
037:        //the software.
038:        //
039:        //Any changes to this file according to the GPL as documented in the file
040:        //gpl.txt aside this file in the shipment you received can be done to the
041:        //lines that follows this copyright notice here, but changes must not be
042:        //done inside the copyright notive above. A re-distribution must contain
043:        //the intact and unchanged copyright notice.
044:        //Contributions and changes to the program code must be marked as such.
045:
046:        //You must compile this file with
047:        //javac -classpath .:../Classes Settings_p.java
048:        //if the shell's current path is HTROOT
049:
050:        package de.anomic.http;
051:
052:        import java.util.HashSet;
053:
054:        import de.anomic.plasma.plasmaSwitchboard;
055:
056:        public final class httpRemoteProxyConfig {
057:
058:            /*
059:             * Remote Proxy configuration
060:             */
061:            private boolean remoteProxyUse;
062:            private boolean remoteProxyUse4Yacy;
063:            private boolean remoteProxyUse4SSL;
064:
065:            private String remoteProxyHost;
066:            private int remoteProxyPort;
067:            private String remoteProxyUser;
068:            private String remoteProxyPwd;
069:
070:            private String remoteProxyNoProxy = "";
071:            private String[] remoteProxyNoProxyPatterns = null;
072:
073:            public final HashSet<String> remoteProxyAllowProxySet = new HashSet<String>();
074:            public final HashSet<String> remoteProxyDisallowProxySet = new HashSet<String>();
075:
076:            public boolean useProxy() {
077:                return this .remoteProxyUse;
078:            }
079:
080:            public boolean useProxy4Yacy() {
081:                return this .remoteProxyUse4Yacy;
082:            }
083:
084:            public boolean useProxy4SSL() {
085:                return this .remoteProxyUse4SSL;
086:            }
087:
088:            public String getProxyHost() {
089:                return this .remoteProxyHost;
090:            }
091:
092:            public int getProxyPort() {
093:                return this .remoteProxyPort;
094:            }
095:
096:            public String getProxyUser() {
097:                return this .remoteProxyUser;
098:            }
099:
100:            public String getProxyPwd() {
101:                return this .remoteProxyPwd;
102:            }
103:
104:            public String getProxyNoProxy() {
105:                return this .remoteProxyNoProxy;
106:            }
107:
108:            public String[] getProxyNoProxyPatterns() {
109:                return this .remoteProxyNoProxyPatterns;
110:            }
111:
112:            public String toString() {
113:                StringBuffer toStrBuf = new StringBuffer();
114:
115:                toStrBuf.append("Status: ").append(
116:                        this .remoteProxyUse ? "ON" : "OFF").append(" | ")
117:                        .append("Host: ");
118:                if ((this .remoteProxyUser != null)
119:                        && (this .remoteProxyUser.length() > 0)) {
120:                    toStrBuf.append(this .remoteProxyUser).append("@");
121:                }
122:                toStrBuf.append(
123:                        (this .remoteProxyHost == null) ? "unknown"
124:                                : this .remoteProxyHost).append(":").append(
125:                        this .remoteProxyPort).append(" | ").append(
126:                        "Usage: HTTP");
127:                if (this .remoteProxyUse4Yacy)
128:                    toStrBuf.append(" YACY");
129:                if (this .remoteProxyUse4SSL)
130:                    toStrBuf.append(" SSL");
131:                toStrBuf.append(" | ").append("No Proxy for: ").append(
132:                        this .remoteProxyNoProxy);
133:
134:                return new String(toStrBuf);
135:            }
136:
137:            public static httpRemoteProxyConfig init(String proxyHostName,
138:                    int proxyHostPort) {
139:                httpRemoteProxyConfig newConfig = new httpRemoteProxyConfig();
140:
141:                newConfig.remoteProxyUse = true;
142:                newConfig.remoteProxyUse4SSL = true;
143:                newConfig.remoteProxyUse4Yacy = true;
144:                newConfig.remoteProxyPort = proxyHostPort;
145:                newConfig.remoteProxyHost = proxyHostName;
146:                if ((newConfig.remoteProxyHost == null)
147:                        || (newConfig.remoteProxyHost.length() == 0)) {
148:                    newConfig.remoteProxyUse = false;
149:                }
150:
151:                return newConfig;
152:            }
153:
154:            public static httpRemoteProxyConfig init(plasmaSwitchboard sb) {
155:                httpRemoteProxyConfig newConfig = new httpRemoteProxyConfig();
156:
157:                // determining if remote proxy usage is enabled
158:                newConfig.remoteProxyUse = sb.getConfig("remoteProxyUse",
159:                        "false").equalsIgnoreCase("true");
160:
161:                // determining if remote proxy should be used for yacy -> yacy communication
162:                newConfig.remoteProxyUse4Yacy = sb.getConfig(
163:                        "remoteProxyUse4Yacy", "true").equalsIgnoreCase("true");
164:
165:                // determining if remote proxy should be used for ssl connections
166:                newConfig.remoteProxyUse4SSL = sb.getConfig(
167:                        "remoteProxyUse4SSL", "true").equalsIgnoreCase("true");
168:
169:                // reading the proxy host name
170:                newConfig.remoteProxyHost = sb.getConfig("remoteProxyHost", "")
171:                        .trim();
172:                if ((newConfig.remoteProxyHost == null)
173:                        || (newConfig.remoteProxyHost.length() == 0)) {
174:                    newConfig.remoteProxyUse = false;
175:                }
176:
177:                // reading the proxy host port
178:                try {
179:                    newConfig.remoteProxyPort = Integer.parseInt(sb.getConfig(
180:                            "remoteProxyPort", "3128"));
181:                } catch (NumberFormatException e) {
182:                    newConfig.remoteProxyPort = 3128;
183:                }
184:
185:                newConfig.remoteProxyUser = sb.getConfig("remoteProxyUser", "")
186:                        .trim();
187:                newConfig.remoteProxyPwd = sb.getConfig("remoteProxyPwd", "")
188:                        .trim();
189:
190:                // determining addresses for which the remote proxy should not be used
191:                newConfig.remoteProxyNoProxy = sb.getConfig(
192:                        "remoteProxyNoProxy", "").trim();
193:                newConfig.remoteProxyNoProxyPatterns = newConfig.remoteProxyNoProxy
194:                        .split(",");
195:
196:                return newConfig;
197:            }
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.