Source Code Cross Referenced for EditConnectorAction.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » catalina » 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.webapp.jonasadmin.catalina 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2003-2004 Bull S.A.
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: EditConnectorAction.java 10100 2007-03-27 13:55:44Z danesa $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.webapp.jonasadmin.catalina;
025:
026:        import java.io.IOException;
027:        import java.net.InetAddress;
028:        import java.util.Iterator;
029:
030:        import javax.management.MalformedObjectNameException;
031:        import javax.management.ObjectName;
032:        import javax.servlet.ServletException;
033:        import javax.servlet.http.HttpServletRequest;
034:        import javax.servlet.http.HttpServletResponse;
035:
036:        import org.apache.struts.action.ActionForm;
037:        import org.apache.struts.action.ActionForward;
038:        import org.apache.struts.action.ActionMapping;
039:        import org.apache.struts.action.ActionMessage;
040:        import org.objectweb.jonas.jmx.CatalinaObjectName;
041:        import org.objectweb.jonas.jmx.JonasManagementRepr;
042:        import org.objectweb.jonas.webapp.jonasadmin.Jlists;
043:        import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
044:
045:        /**
046:         * @author Michel-Ange ANTON
047:         * @author Adriana Danes
048:         * - update to Tomact 5.0
049:         * - update to Tomact 5.5 (04/2005)
050:         */
051:        public class EditConnectorAction extends CatalinaBaseAction {
052:
053:            // --------------------------------------------------------- Public Methods
054:
055:            public ActionForward executeAction(ActionMapping pMapping,
056:                    ActionForm pForm, HttpServletRequest pRequest,
057:                    HttpServletResponse pResponse) throws IOException,
058:                    ServletException {
059:
060:                // Current JOnAS server name
061:                String serverName = m_WhereAreYou.getCurrentJonasServerName();
062:
063:                // Current Tomcat Connector MBean (to be used to create form)
064:                ObjectName oObjectName = null;
065:
066:                // Selected Tomcat Connector MBean
067:                ObjectName selectObjectName = null;
068:                try {
069:                    selectObjectName = new ObjectName(pRequest
070:                            .getParameter("select"));
071:                } catch (Exception e) {
072:                    m_Errors.add("select", new ActionMessage(
073:                            "error.catalina.connector.select.bad", pRequest
074:                                    .getParameter("select")));
075:                    addGlobalError(e);
076:                    saveErrors(pRequest, m_Errors);
077:                    return (pMapping.findForward("Global Error"));
078:                }
079:                String selectedPort = selectObjectName.getKeyProperty("port");
080:                String selectedAddress = selectObjectName
081:                        .getKeyProperty("address");
082:                // Check InetAddress corectness (get round Tomcat bug)
083:                if (selectedAddress != null) {
084:                    boolean fromTreeBuilder = false;
085:                    if (selectedAddress.startsWith("/")) {
086:                        // We come fropm the tree builder
087:                        selectedAddress = selectedAddress.substring(1);
088:                        fromTreeBuilder = true;
089:                    }
090:                    ObjectName o;
091:                    try {
092:                        o = ObjectName
093:                                .getInstance(m_WhereAreYou
094:                                        .getCurrentDomainName()
095:                                        + ":type=Connector,port="
096:                                        + selectedPort + ",*");
097:                    } catch (MalformedObjectNameException e) {
098:                        addGlobalError(e);
099:                        saveErrors(pRequest, m_Errors);
100:                        return (pMapping.findForward("Global Error"));
101:                    }
102:                    Iterator it = JonasManagementRepr.queryNames(o, serverName)
103:                            .iterator();
104:                    while (it.hasNext()) {
105:                        ObjectName on = (ObjectName) it.next();
106:                        if (on.getKeyProperty("port").equals(selectedPort)) {
107:                            String foundAddress = on.getKeyProperty("address");
108:                            if (foundAddress != null) {
109:                                if (fromTreeBuilder) {
110:                                    // starting / in selected address was eliminated
111:                                    if (foundAddress.endsWith(selectedAddress)) {
112:                                        oObjectName = on;
113:                                        break;
114:                                    }
115:                                } else {
116:                                    // selected address starts with %2F
117:                                    if (foundAddress.equals(selectedAddress)) {
118:                                        // now we can eliminate the %2F
119:                                        if (selectedAddress.startsWith("%2F")) {
120:                                            selectedAddress = selectedAddress
121:                                                    .substring(3);
122:                                        }
123:                                        oObjectName = on;
124:                                        break;
125:                                    }
126:
127:                                }
128:                            }
129:                        }
130:                    }
131:                    // be sure oObjectName not null
132:                    if (oObjectName == null) {
133:                        oObjectName = selectObjectName;
134:                    }
135:                } else {
136:                    // use selected ObjectName directly
137:                    oObjectName = selectObjectName;
138:                }
139:
140:                // Fill in the form values for display and editing
141:                ConnectorForm oForm = new ConnectorForm();
142:                m_Session.setAttribute("catalinaConnectorForm", oForm);
143:                oForm.setAction("edit");
144:                oForm.setObjectName(oObjectName.toString());
145:                oForm.setBooleanVals(Jlists.getBooleanValues());
146:                // Populate
147:                try {
148:                    // Determine connector type
149:                    String sHandlerClassName = getStringAttribute(oObjectName,
150:                            "protocolHandlerClassName");
151:                    int period = sHandlerClassName.lastIndexOf('.');
152:                    String sHandlerType = sHandlerClassName
153:                            .substring(period + 1);
154:                    if ("JkCoyoteHandler".equalsIgnoreCase(sHandlerType)) {
155:                        oForm.setConnectorType("AJP");
156:                    } else if ("Http11Protocol".equalsIgnoreCase(sHandlerType)) {
157:                        if ("http".equalsIgnoreCase(oForm.getScheme())) {
158:                            oForm.setConnectorType("HTTP");
159:                        } else if ("https".equalsIgnoreCase(oForm.getScheme())) {
160:                            oForm.setConnectorType("HTTPS");
161:                        }
162:                    } else {
163:                        oForm.setConnectorType("????");
164:                    }
165:                    // Common properties
166:                    oForm.setAllowTrace(getBooleanAttribute(oObjectName,
167:                            "allowTrace"));
168:                    oForm.setEmptySessionPath(getBooleanAttribute(oObjectName,
169:                            "emptySessionPath"));
170:                    oForm.setEnableLookups(getBooleanAttribute(oObjectName,
171:                            "enableLookups"));
172:                    oForm.setMaxPostSizeText(toStringIntegerAttribute(
173:                            oObjectName, "maxPostSize"));
174:                    oForm.setProtocol(getStringAttribute(oObjectName,
175:                            "protocol"));
176:                    oForm.setProxyName(getStringAttribute(oObjectName,
177:                            "proxyName"));
178:                    oForm.setProxyPortText(toStringIntegerAttribute(
179:                            oObjectName, "proxyPort"));
180:                    oForm.setRedirectPortText(toStringIntegerAttribute(
181:                            oObjectName, "redirectPort"));
182:                    oForm.setScheme(getStringAttribute(oObjectName, "scheme"));
183:                    oForm.setSecure(getBooleanAttribute(oObjectName, "secure"));
184:                    oForm.setURIEncoding(getStringAttribute(oObjectName,
185:                            "URIEncoding"));
186:                    oForm.setUseBodyEncodingForURI(getBooleanAttribute(
187:                            oObjectName, "useBodyEncodingForURI"));
188:                    oForm.setXpoweredBy(getBooleanAttribute(oObjectName,
189:                            "xpoweredBy"));
190:                    // Coyote Connector properties
191:                    oForm.setAcceptCountText(toStringIntegerAttribute(
192:                            oObjectName, "acceptCount"));
193:
194:                    InetAddress inetAddress = (InetAddress) JonasManagementRepr
195:                            .getAttribute(oObjectName, "address", serverName);
196:                    if (inetAddress != null) {
197:                        oForm.setAddress(inetAddress.toString());
198:                    }
199:                    oForm.setPortText(toStringIntegerAttribute(oObjectName,
200:                            "port"));
201:                    oForm.setRedirectPortText(toStringIntegerAttribute(
202:                            oObjectName, "redirectPort"));
203:                    oForm.setTcpNoDelay(getBooleanAttribute(oObjectName,
204:                            "tcpNoDelay"));
205:                    // ------ Threads management
206:                    oForm.setMaxThreadsText(toStringIntegerAttribute(
207:                            oObjectName, "maxThreads"));
208:                    oForm.setMinSpareThreadsText(toStringIntegerAttribute(
209:                            oObjectName, "minSpareThreads"));
210:                    oForm.setMaxSpareThreadsText(toStringIntegerAttribute(
211:                            oObjectName, "maxSpareThreads"));
212:
213:                    // Supported by HTTP and HTTPS only
214:                    if (!("AJP".equalsIgnoreCase(oForm.getConnectorType()))) {
215:                        oForm.setBufferSizeText(toStringIntegerAttribute(
216:                                oObjectName, "bufferSize"));
217:                        oForm.setCompression(getStringAttribute(oObjectName,
218:                                "compression"));
219:                        oForm.setConnectionLingerText(toStringIntegerAttribute(
220:                                oObjectName, "connectionLingerText"));
221:                        oForm.setConnTimeOutText(toStringIntegerAttribute(
222:                                oObjectName, "connectionTimeout"));
223:                        oForm
224:                                .setConnectionUploadTimeoutText(toStringIntegerAttribute(
225:                                        oObjectName, "connectionUploadTimeout"));
226:                        oForm.setDisableUploadTimeout(getBooleanAttribute(
227:                                oObjectName, "disableUploadTimeout"));
228:                        oForm
229:                                .setMaxHttpHeaderSizeText(toStringIntegerAttribute(
230:                                        oObjectName, "maxHttpHeaderSize"));
231:                        oForm
232:                                .setMaxKeepAliveRequestsText(toStringIntegerAttribute(
233:                                        oObjectName, "maxKeppAliveRequests"));
234:                        oForm.setStrategy(getStringAttribute(oObjectName,
235:                                "strategy"));
236:                        oForm.setThreadPriorityText(toStringIntegerAttribute(
237:                                oObjectName, "threadPriority"));
238:                    }
239:                    // Supported by AJP only
240:                    if (oForm.getConnectorType() == "AJP") {
241:                        oForm.setOutputBufferSizeText(toStringIntegerAttribute(
242:                                oObjectName, "bufferSize"));
243:                        oForm.setTomcatAuthentication(getBooleanAttribute(
244:                                oObjectName, "tomcatAuthentication"));
245:                    }
246:                    // SSL Support
247:                    if ("HTTPS".equalsIgnoreCase(oForm.getConnectorType())) {
248:                        // These are set only for SSL connectors.
249:                        oForm.setAlgorithm(getStringAttribute(oObjectName,
250:                                "algorithm"));
251:                        oForm.setClientAuth(getBooleanAttribute(oObjectName,
252:                                "clientAuth"));
253:                        oForm.setKeystoreFile(getStringAttribute(oObjectName,
254:                                "keystoreFile"));
255:                        oForm.setKeystorePass(getStringAttribute(oObjectName,
256:                                "keystorePass"));
257:                        oForm.setKeystoreType(getStringAttribute(oObjectName,
258:                                "keystoreType"));
259:                        oForm.setSslProtocol(getStringAttribute(oObjectName,
260:                                "sslProtocol"));
261:                        oForm.setCiphers(getStringAttribute(oObjectName,
262:                                "ciphers"));
263:                    }
264:
265:                    // Force the node selected in tree
266:                    String nodeName = getTreeBranchName(DEPTH_SERVER)
267:                            + WhereAreYou.NODE_SEPARATOR + "protocols"
268:                            + WhereAreYou.NODE_SEPARATOR + "connectors"
269:                            + WhereAreYou.NODE_SEPARATOR
270:                            + m_WhereAreYou.getCurrentCatalinaDomainName()
271:                            + WhereAreYou.NODE_SEPARATOR + oForm.getPortText();
272:                    if (selectedAddress != null) {
273:                        nodeName = nodeName + selectedAddress;
274:                    }
275:                    m_WhereAreYou.selectNameNode(nodeName, true);
276:                } catch (Throwable t) {
277:                    addGlobalError(t);
278:                    saveErrors(pRequest, m_Errors);
279:                    return (pMapping.findForward("Global Error"));
280:                }
281:                // Forward to the connector display page
282:                return (pMapping.findForward("Catalina Connector"));
283:            }
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.