Source Code Cross Referenced for ProxyProp.java in  » Web-Server » Jigsaw » org » w3c » jigsaw » proxy » 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 » Web Server » Jigsaw » org.w3c.jigsaw.proxy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // ProxyProp.java
002:        // $Id: ProxyProp.java,v 1.20 2004/01/06 10:09:34 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigsaw.proxy;
007:
008:        import java.util.Enumeration;
009:
010:        import java.io.File;
011:
012:        import org.w3c.tools.resources.Attribute;
013:        import org.w3c.tools.resources.AttributeRegistry;
014:        import org.w3c.tools.resources.BooleanAttribute;
015:        import org.w3c.tools.resources.IntegerAttribute;
016:        import org.w3c.tools.resources.StringArrayAttribute;
017:        import org.w3c.tools.resources.StringAttribute;
018:
019:        import org.w3c.jigsaw.http.httpd;
020:
021:        import org.w3c.jigsaw.config.PropertySet;
022:
023:        import org.w3c.util.ObservableProperties;
024:
025:        import org.w3c.www.protocol.http.micp.MICPProp;
026:
027:        import org.w3c.www.protocol.http.HttpManager;
028:        import org.w3c.www.protocol.http.cache.CacheFilter;
029:        import org.w3c.www.protocol.http.cache.CacheStore;
030:
031:        class ProxyProp extends PropertySet {
032:            private static String title = "Proxy properties";
033:
034:            private static String MICP_PROP_NAME = "micp";
035:            private static String CACHE_PROP_NAME = "cache";
036:            private static String PROXY_DISP_PROP_NAME = "dispatcher";
037:
038:            protected static int ATTR_FILTERS = -1;
039:
040:            static {
041:                Class c = null;
042:                Attribute a = null;
043:
044:                try {
045:                    c = Class.forName("org.w3c.jigsaw.proxy.ProxyProp");
046:                } catch (Exception ex) {
047:                    ex.printStackTrace();
048:                    System.exit(1);
049:                }
050:                // Register the maximum number of allowed connections:
051:                a = new IntegerAttribute(HttpManager.CONN_MAX_P,
052:                        new Integer(20), Attribute.EDITABLE);
053:                AttributeRegistry.registerAttribute(c, a);
054:                // Register the timeout on the client socket
055:                a = new IntegerAttribute(HttpManager.TIMEOUT_P, new Integer(
056:                        300000) // default 5mn
057:                        , Attribute.EDITABLE);
058:                AttributeRegistry.registerAttribute(c, a);
059:                // Register the connection timeout on the client socket
060:                a = new IntegerAttribute(HttpManager.CONN_TIMEOUT_P,
061:                        new Integer(1000) // default 1s
062:                        , Attribute.EDITABLE);
063:                AttributeRegistry.registerAttribute(c, a);
064:                // Register the proxy set property
065:                a = new BooleanAttribute(HttpManager.PROXY_SET_P, null,
066:                        Attribute.EDITABLE);
067:                AttributeRegistry.registerAttribute(c, a);
068:                // Register the proxy host:
069:                a = new StringAttribute(HttpManager.PROXY_HOST_P, null,
070:                        Attribute.EDITABLE);
071:                AttributeRegistry.registerAttribute(c, a);
072:                // Register the proxy port:
073:                a = new IntegerAttribute(HttpManager.PROXY_PORT_P, new Integer(
074:                        80), Attribute.EDITABLE);
075:                AttributeRegistry.registerAttribute(c, a);
076:                // Register the lenient parsing mode property
077:                a = new BooleanAttribute(HttpManager.LENIENT_P, null,
078:                        Attribute.EDITABLE);
079:                AttributeRegistry.registerAttribute(c, a);
080:                // Register the filters property
081:                a = new StringArrayAttribute(HttpManager.FILTERS_PROP_P, null,
082:                        Attribute.EDITABLE);
083:                ATTR_FILTERS = AttributeRegistry.registerAttribute(c, a);
084:            }
085:
086:            /**
087:             * Get this property set title.
088:             * @return A String encoded title.
089:             */
090:
091:            public String getTitle() {
092:                return title;
093:            }
094:
095:            /**
096:             * Set value forwards the effectation to the properties.
097:             * @param idx The attribute (property in that case) being set.
098:             * @param value The new value for that property.
099:             */
100:
101:            protected String[] getFilters() {
102:                return (String[]) getValue(ATTR_FILTERS, null);
103:            }
104:
105:            protected void initializeFiltersProps() {
106:                String flt[] = getFilters();
107:                if (flt == null)
108:                    return;
109:                // FIXME! shouldget the name of the property set associated
110:                // to the filter, and verify if it is present or not
111:                // if not, register the property set
112:                PropertySet p = null;
113:                for (int i = 0; i < flt.length; i++) {
114:                    if (flt[i]
115:                            .equals("org.w3c.www.protocol.http.micp.MICPFilter")) {
116:                        if (server.getPropertySet(MICP_PROP_NAME) == null) {
117:                            p = new MICPProp(MICP_PROP_NAME, server);
118:                            server.registerPropertySet(p);
119:                        }
120:                    } else if (flt[i]
121:                            .equals("org.w3c.www.protocol.http.cache.CacheFilter")) {
122:                        if (server.getPropertySet(CACHE_PROP_NAME) == null) {
123:                            p = new CacheProp(CACHE_PROP_NAME, server);
124:                            server.registerPropertySet(p);
125:                            ObservableProperties props = server.getProperties();
126:                            File c = props.getFile(
127:                                    CacheStore.CACHE_DIRECTORY_P, null);
128:                            if (c == null) {
129:                                c = new File(server.getConfigDirectory(),
130:                                        "cache");
131:                                props.putValue(CacheStore.CACHE_DIRECTORY_P, c
132:                                        .getAbsolutePath());
133:                            }
134:                        }
135:                    } else if (flt[i]
136:                            .equals("org.w3c.www.protocol.http.proxy.ProxyDispatcher")) {
137:                        //add ProxyDispatcher PropertySet...
138:                        if (server.getPropertySet(PROXY_DISP_PROP_NAME) == null) {
139:                            p = new ProxyDispatcherProp(PROXY_DISP_PROP_NAME,
140:                                    server);
141:                            server.registerPropertySet(p);
142:                        }
143:                    }
144:                }
145:            }
146:
147:            public synchronized void setValue(int idx, Object value) {
148:                // Check access (we don't care about side effects)
149:                super .setValue(idx, value);
150:                if (idx == ATTR_FILTERS)
151:                    initializeFiltersProps();
152:            }
153:
154:            ProxyProp(String name, httpd server) {
155:                super(name, server);
156:                initializeFiltersProps();
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.