Source Code Cross Referenced for Jetty.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » ant » jonasbase » web » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.ant.jonasbase.web 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: Jetty.java 7939 2006-01-25 17:35:15Z sauthieg $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.ant.jonasbase.web;
025:
026:        import org.objectweb.jonas.ant.JOnASBaseTask;
027:        import org.objectweb.jonas.ant.jonasbase.JReplace;
028:        import org.objectweb.jonas.ant.jonasbase.Tasks;
029:
030:        /**
031:         * Support Jetty Connector Configuration.
032:         *
033:         * @author Guillaume Sauthier
034:         */
035:        public class Jetty extends Tasks {
036:
037:            /**
038:             * Info for the logger
039:             */
040:            private static final String INFO = "[Jetty] ";
041:
042:            /**
043:             * HTTPS TOKEN
044:             */
045:            private static final String HTTPS_TOKEN = "<!-- Add a HTTPS SSL listener on port 9043";
046:
047:            /**
048:             * AJP TOKEN
049:             */
050:            private static final String AJP_TOKEN = "<!-- Add a AJP13 listener on port 8009";
051:
052:            /**
053:             * Default Constructor.
054:             */
055:            public Jetty() {
056:                super ();
057:            }
058:
059:            /**
060:             * Configure a HTTP Connector.
061:             * @param http HTTP Configuration.
062:             */
063:            public void addConfiguredHttp(Http http) {
064:                JReplace propertyReplace = new JReplace();
065:                propertyReplace
066:                        .setConfigurationFile(JOnASBaseTask.JETTY_CONF_FILE);
067:                propertyReplace.setToken(Http.DEFAULT_PORT);
068:                propertyReplace.setValue(http.getPort());
069:                propertyReplace.setLogInfo(INFO
070:                        + "Setting HTTP port number to : " + http.getPort());
071:                addTask(propertyReplace);
072:            }
073:
074:            /**
075:             * Configure a HTTPS Connector.
076:             * @param https HTTPS Configuration.
077:             */
078:            public void addConfiguredHttps(Https https) {
079:                JReplace propertyReplace = new JReplace();
080:                propertyReplace
081:                        .setConfigurationFile(JOnASBaseTask.JETTY_CONF_FILE);
082:                propertyReplace.setToken(HTTPS_TOKEN);
083:                StringBuffer value = new StringBuffer();
084:                value.append("<!-- Add a HTTPS SSL listener on port "
085:                        + https.getPort() + "                           -->\n");
086:                value
087:                        .append("  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->\n");
088:                value.append("  <Call name=\"addListener\">\n");
089:                value.append("    <Arg>\n");
090:                if (Https.IBM_VM.equalsIgnoreCase(https.getVm())) {
091:                    value
092:                            .append("      <New class=\"org.mortbay.http.IbmJsseListener\">\n");
093:                } else {
094:                    // default to Sun
095:                    value
096:                            .append("      <New class=\"org.mortbay.http.SunJsseListener\">\n");
097:                }
098:                value.append("        <Set name=\"Port\">" + https.getPort()
099:                        + "</Set>\n");
100:                value.append("        <Set name=\"MinThreads\">5</Set>\n");
101:                value.append("        <Set name=\"MaxThreads\">100</Set>\n");
102:                value
103:                        .append("        <Set name=\"MaxIdleTimeMs\">30000</Set>\n");
104:                value
105:                        .append("        <Set name=\"LowResourcePersistTimeMs\">2000</Set>\n");
106:                if (https.getKeystoreFile() != null) {
107:                    value.append("        <Set name=\"Keystore\">"
108:                            + https.getKeystoreFile() + "</Set>\n");
109:                }
110:                if (https.getKeystorePass() != null) {
111:                    value.append("        <Set name=\"Password\">"
112:                            + https.getKeystorePass() + "</Set>\n");
113:                }
114:                if (https.getKeyPassword() != null) {
115:                    value.append("  <Set name=\"KeyPassword\">"
116:                            + https.getKeyPassword() + "</Set>\n");
117:                }
118:                value.append("      </New>\n");
119:                value.append("    </Arg>\n");
120:                value.append("  </Call>\n\n");
121:                value
122:                        .append("  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->\n");
123:                value.append("  " + HTTPS_TOKEN);
124:                propertyReplace.setValue(value.toString());
125:                propertyReplace.setLogInfo(INFO
126:                        + "Setting HTTPS port number to : " + https.getPort());
127:                addTask(propertyReplace);
128:
129:                propertyReplace = new JReplace();
130:                propertyReplace
131:                        .setConfigurationFile(JOnASBaseTask.JETTY_CONF_FILE);
132:                propertyReplace.setToken(Https.DEFAULT_PORT);
133:                propertyReplace.setValue(https.getPort());
134:                propertyReplace.setLogInfo(INFO
135:                        + "Fix HTTP redirect port number to : "
136:                        + https.getPort());
137:                addTask(propertyReplace);
138:
139:            }
140:
141:            /**
142:             * Configure an AJP Connector.
143:             * @param ajp AJP Configuration.
144:             */
145:            public void addConfiguredAjp(Ajp ajp) {
146:                JReplace propertyReplace = new JReplace();
147:                propertyReplace
148:                        .setConfigurationFile(JOnASBaseTask.JETTY_CONF_FILE);
149:                propertyReplace.setToken(AJP_TOKEN);
150:                StringBuffer value = new StringBuffer();
151:                value.append("<!-- Add a AJP13 listener on port "
152:                        + ajp.getPort()
153:                        + "                               -->\n");
154:                value
155:                        .append("  <!-- This protocol can be used with mod_jk in apache, IIS etc.       -->\n");
156:                value
157:                        .append("  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->\n");
158:                value.append("  <Call name=\"addListener\">\n");
159:                value.append("    <Arg>\n");
160:                value
161:                        .append("      <New class=\"org.mortbay.http.ajp.AJP13Listener\">\n");
162:                value.append("        <Set name=\"Port\">" + ajp.getPort()
163:                        + "</Set>\n");
164:                value.append("        <Set name=\"MinThreads\">5</Set>\n");
165:                value.append("        <Set name=\"MaxThreads\">20</Set>\n");
166:                value.append("        <Set name=\"MaxIdleTimeMs\">0</Set>\n");
167:                value
168:                        .append("        <Set name=\"confidentialPort\">9043</Set>\n");
169:                value.append("      </New>\n");
170:                value.append("    </Arg>\n");
171:                value.append("  </Call>\n\n");
172:                value
173:                        .append("  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->\n");
174:                value.append("  " + AJP_TOKEN);
175:                propertyReplace.setValue(value.toString());
176:                propertyReplace.setLogInfo(INFO + "Setting AJP Connector to : "
177:                        + ajp.getPort());
178:                addTask(propertyReplace);
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.