Source Code Cross Referenced for HttpServerConfig.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » runtime » component » http » server » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.runtime.component.http.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         * 		Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2007 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id: HttpServerConfig.java 8843 2007-08-30 15:09:27Z mpreston $
023:         */
024:        package com.bostechcorp.cbesb.runtime.component.http.server;
025:
026:        import org.apache.commons.logging.Log;
027:        import org.apache.commons.logging.LogFactory;
028:
029:        import com.bostechcorp.cbesb.runtime.component.http.HttpEndpoint;
030:
031:        public class HttpServerConfig {
032:
033:            protected final transient Log logger = LogFactory
034:                    .getLog(getClass());
035:
036:            private boolean ssl;
037:            private String host;
038:            private int port;
039:
040:            private String sslProtocol;
041:            private String keyStoreFile;
042:            private String keyStorePassword;
043:            private String trustStoreFile;
044:            private String trustStorePassword;
045:            private boolean authenticateClient;
046:
047:            public HttpServerConfig() {
048:
049:            }
050:
051:            public HttpServerConfig(String url) {
052:                initFromURL(url);
053:            }
054:
055:            public HttpServerConfig(HttpEndpoint endpoint) {
056:                initFromURL(endpoint.getLocationURI());
057:                if (isSsl()) {
058:                    if (endpoint.getSslProtocol() != null) {
059:                        sslProtocol = endpoint.getSslProtocol();
060:                    } else {
061:                        sslProtocol = "TLS";
062:                    }
063:                    keyStoreFile = endpoint.getKeyStoreFile();
064:                    keyStorePassword = endpoint.getKeyStorePassword();
065:                    if (!endpoint.isUseDefaultTrustStore()) {
066:                        trustStoreFile = endpoint.getTrustStoreFile();
067:                        trustStorePassword = endpoint.getTrustStorePassword();
068:                    }
069:                    authenticateClient = endpoint.isAuthenticateClient();
070:                }
071:            }
072:
073:            /**
074:             * @return the host
075:             */
076:            public String getHost() {
077:                return host;
078:            }
079:
080:            /**
081:             * @param host the host to set
082:             */
083:            public void setHost(String host) {
084:                this .host = host;
085:            }
086:
087:            /**
088:             * @return the port
089:             */
090:            public int getPort() {
091:                return port;
092:            }
093:
094:            /**
095:             * @param port the port to set
096:             */
097:            public void setPort(int port) {
098:                this .port = port;
099:            }
100:
101:            /**
102:             * @return the ssl
103:             */
104:            public boolean isSsl() {
105:                return ssl;
106:            }
107:
108:            /**
109:             * @param ssl the ssl to set
110:             */
111:            public void setSsl(boolean ssl) {
112:                this .ssl = ssl;
113:            }
114:
115:            /**
116:             * @return the authenticateClient
117:             */
118:            public boolean isAuthenticateClient() {
119:                return authenticateClient;
120:            }
121:
122:            /**
123:             * @param authenticateClient the authenticateClient to set
124:             */
125:            public void setAuthenticateClient(boolean authenticateClient) {
126:                this .authenticateClient = authenticateClient;
127:            }
128:
129:            /**
130:             * @return the keyStoreFile
131:             */
132:            public String getKeyStoreFile() {
133:                return keyStoreFile;
134:            }
135:
136:            /**
137:             * @param keyStoreFile the keyStoreFile to set
138:             */
139:            public void setKeyStoreFile(String keyStoreFile) {
140:                this .keyStoreFile = keyStoreFile;
141:            }
142:
143:            /**
144:             * @return the keyStorePassword
145:             */
146:            public String getKeyStorePassword() {
147:                return keyStorePassword;
148:            }
149:
150:            /**
151:             * @param keyStorePassword the keyStorePassword to set
152:             */
153:            public void setKeyStorePassword(String keyStorePassword) {
154:                this .keyStorePassword = keyStorePassword;
155:            }
156:
157:            /**
158:             * @return the sslProtocol
159:             */
160:            public String getSslProtocol() {
161:                return sslProtocol;
162:            }
163:
164:            /**
165:             * @param sslProtocol the sslProtocol to set
166:             */
167:            public void setSslProtocol(String sslProtocol) {
168:                this .sslProtocol = sslProtocol;
169:            }
170:
171:            /**
172:             * @return the trustStoreFile
173:             */
174:            public String getTrustStoreFile() {
175:                return trustStoreFile;
176:            }
177:
178:            /**
179:             * @param trustStoreFile the trustStoreFile to set
180:             */
181:            public void setTrustStoreFile(String trustStoreFile) {
182:                this .trustStoreFile = trustStoreFile;
183:            }
184:
185:            /**
186:             * @return the trustStorePassword
187:             */
188:            public String getTrustStorePassword() {
189:                return trustStorePassword;
190:            }
191:
192:            /**
193:             * @param trustStorePassword the trustStorePassword to set
194:             */
195:            public void setTrustStorePassword(String trustStorePassword) {
196:                this .trustStorePassword = trustStorePassword;
197:            }
198:
199:            public String getURL() {
200:                StringBuffer buf = new StringBuffer();
201:                if (isSsl()) {
202:                    buf.append("https://");
203:                } else {
204:                    buf.append("http://");
205:                }
206:                buf.append(getHost());
207:                if (getPort() > 0 && getPort() != 80 && getPort() != 443) {
208:                    buf.append(":" + Integer.toString(getPort()));
209:                }
210:                return buf.toString();
211:            }
212:
213:            private void initFromURL(String url) {
214:                int index = 0;
215:                if (url.startsWith("http://")) {
216:                    setSsl(false);
217:                    index = "http://".length();
218:                } else if (url.startsWith("https://")) {
219:                    setSsl(true);
220:                    index = "https://".length();
221:                } else {
222:                    logger
223:                            .error("URL must begin with 'http://' or 'https://' - "
224:                                    + url);
225:                    return;
226:                }
227:                int index2 = url.indexOf('/', index);
228:                String host;
229:                if (index2 == -1) {
230:                    host = url.substring(index);
231:
232:                } else {
233:                    host = url.substring(index, index2);
234:                }
235:
236:                String[] tmpArray = host.split(":");
237:                if (tmpArray.length > 0) {
238:                    setHost(tmpArray[0]);
239:                    if (tmpArray.length > 1) {
240:                        setPort(Integer.parseInt(tmpArray[1]));
241:                    } else {
242:                        //no port specified, use defaults for protocol
243:                        if (isSsl()) {
244:                            port = 443;
245:                        } else {
246:                            port = 80;
247:                        }
248:                    }
249:                }
250:            }
251:
252:            public String toString() {
253:                return host + ":" + port + "  SSL=" + ssl;
254:            }
255:
256:            public boolean equals(HttpServerConfig config) {
257:                return (this.host.equals(config.getHost())
258:                        && this.port == config.getPort() && this.ssl == config
259:                        .isSsl());
260:            }
261:        }
w__w_w_.___j___ava2___s___.__c__o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.