Source Code Cross Referenced for PACFileIntranetInfo.java in  » Portal » Open-Portal » com » sun » portal » util » 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 » Portal » Open Portal » com.sun.portal.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * PACFileIntranetInfo.java
003:         *
004:         * Created on May 16, 2003, 1:57 PM
005:         */
006:
007:        package com.sun.portal.util;
008:
009:        import java.util.StringTokenizer;
010:        import java.util.logging.Level;
011:        import java.util.logging.Logger;
012:
013:        import com.sun.portal.log.common.PortalLogger;
014:        import com.sun.portal.rproxy.server.GatewayContext;
015:        import com.sun.portal.rproxy.server.GatewayContextFactory;
016:
017:        /**
018:         * 
019:         * @author mm132998
020:         * @version
021:         */
022:        public class PACFileIntranetInfo implements  IntranetInfo {
023:
024:            private static final char PIPE = '|';
025:
026:            private static final char SPACE = ' ';
027:
028:            private static final char DOT = '.';
029:
030:            private static final String STAR_DOT_STRING = "*.";
031:
032:            private static final String STAR_STRING = "*";
033:
034:            // static Logger logger = Logger.getLogger("com.sun.portal.sra.rproxy");
035:            private static Logger logger = PortalLogger
036:                    .getLogger(PACFileIntranetInfo.class);
037:
038:            private String defaultDomain;
039:
040:            private String defaultSubDomainAndDomain;
041:
042:            private void initDefaultDomainSubDomain() {
043:
044:                GatewayContext gatewayContext = GatewayContextFactory
045:                        .getGatewayContext();
046:
047:                String defaultDomainSubDomain = gatewayContext
048:                        .getDefaultDomainAndSubDomain(); // GatewayProfile.getString(DEFAULT_DOMAIN_AND_SUBDOMAINS,"").toLowerCase();
049:
050:                String[] splitEntry = StringHelper.split(
051:                        defaultDomainSubDomain, PIPE);
052:
053:                if (splitEntry.length == 0) {
054:                    defaultDomain = "";
055:                    defaultSubDomainAndDomain = "";
056:                    // logger.severe("The default sub-domain / domain not specified in
057:                    // gateway profile!");
058:                    logger.severe("PSSR_CSPU085");
059:                } else if (splitEntry.length == 1) {
060:                    defaultDomain = DOT + splitEntry[0];
061:                    defaultSubDomainAndDomain = defaultDomain;
062:                } else {
063:                    defaultDomain = DOT + splitEntry[0];
064:                    defaultSubDomainAndDomain = DOT + splitEntry[1]
065:                            + defaultDomain;
066:                }
067:            }
068:
069:            private String pacFileLocation = null;
070:
071:            /** Creates new PACFileIntranetInfo */
072:            public PACFileIntranetInfo(String pacFileLocation) throws Exception {
073:                this .pacFileLocation = pacFileLocation;
074:                initDefaultDomainSubDomain();
075:                EvalPAC.initPACFile(pacFileLocation);
076:            }
077:
078:            public String internGetWebProxy(String protocol, String host) {
079:
080:                String proxy = EvalPAC.getProxy(protocol, host, "127.0.0.1");
081:                if (proxy == null || proxy.trim().length() == 0
082:                        || proxy.trim().equalsIgnoreCase("null")) {
083:                    return null;
084:                }
085:                StringTokenizer st = new StringTokenizer(proxy);
086:                String type = st.nextToken();
087:
088:                if (type.equalsIgnoreCase("SOCKS")) {
089:                    // logger.severe("Gateway does not support SOCKS proxies !\n" +
090:                    // "Socks proxy \"" + proxy+ "\" returned for host : " + host);
091:                    Object[] params = { "\n", proxy, host };
092:                    logger.log(Level.SEVERE, "PSSR_CSPU086", params);
093:                    return null;
094:                } else if (type.equalsIgnoreCase("DIRECT")) {
095:                    return null;
096:                }
097:                StringTokenizer st1 = new StringTokenizer(st.nextToken(), ";");
098:                String retval = st1.nextToken();
099:                return retval;
100:            }
101:
102:            public String getWebProxy(String protocol, String host) {
103:                String proxy = internGetWebProxy(protocol, host);
104:
105:                if (proxy == null && host.indexOf('.') == -1) {
106:                    proxy = internGetWebProxy(protocol, host
107:                            + defaultSubDomainAndDomain);
108:                }
109:                return proxy;
110:            }
111:
112:            public boolean internContainHost(String host) {
113:                // It does not matter whether it is http or https to decide
114:                // whether this is part of the intranet.
115:                String proxy = EvalPAC.getProxy("http", host, "127.0.0.1");
116:                if (proxy == null || proxy.trim().length() == 0
117:                        || proxy.trim().equalsIgnoreCase("null")) {
118:                    return false;
119:                }
120:                StringTokenizer st = new StringTokenizer(proxy);
121:                String type = st.nextToken();
122:
123:                if (type.equalsIgnoreCase("STARPROXY")) {
124:                    return false;
125:                }
126:                return true;
127:            }
128:
129:            public boolean containHost(String host) {
130:                boolean retval = internContainHost(host);
131:
132:                if (!retval && host.indexOf('.') == -1) {
133:                    retval = internContainHost(host + defaultSubDomainAndDomain);
134:                }
135:                return retval;
136:            }
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.