1 25 26 package org.objectweb.jonas.webapp.jonasadmin.catalina; 27 28 import java.io.IOException ; 29 30 import javax.management.ObjectName ; 31 import javax.servlet.ServletException ; 32 import javax.servlet.http.HttpServletRequest ; 33 import javax.servlet.http.HttpServletResponse ; 34 35 import org.apache.struts.action.ActionForm; 36 import org.apache.struts.action.ActionForward; 37 import org.apache.struts.action.ActionMapping; 38 import org.apache.struts.action.ActionMessage; 39 import org.objectweb.jonas.webapp.jonasadmin.Jlists; 40 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 42 48 public class EditConnectorAction extends CatalinaBaseAction { 49 50 52 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 53 , HttpServletRequest pRequest, HttpServletResponse pResponse) 54 throws IOException , ServletException { 55 56 ObjectName oObjectName = null; 58 try { 59 oObjectName = new ObjectName (pRequest.getParameter("select")); 60 } catch (Exception e) { 61 m_Errors.add("select", new ActionMessage("error.catalina.connector.select.bad" 62 , pRequest.getParameter("select"))); 63 addGlobalError(e); 64 saveErrors(pRequest, m_Errors); 65 return (pMapping.findForward("Global Error")); 66 } 67 68 ConnectorForm oForm = new ConnectorForm(); 70 m_Session.setAttribute("catalinaConnectorForm", oForm); 71 oForm.setAction("edit"); 72 oForm.setObjectName(oObjectName.toString()); 73 oForm.setDebugLvlVals(Jlists.getDebugLevels()); 74 oForm.setBooleanVals(Jlists.getBooleanValues()); 75 76 try { 78 String sHandlerClassName = getStringAttribute(oObjectName, "protocolHandlerClassName"); 80 int period = sHandlerClassName.lastIndexOf('.'); 81 String sHandlerType = sHandlerClassName.substring(period + 1); 82 if ("JkCoyoteHandler".equalsIgnoreCase(sHandlerType)) { 83 oForm.setConnectorType("AJP"); 84 } else if ("Http11Protocol".equalsIgnoreCase(sHandlerType)) { 85 if ("http".equalsIgnoreCase(oForm.getScheme())) { 86 oForm.setConnectorType("HTTP"); 87 } else if ("https".equalsIgnoreCase(oForm.getScheme())) { 88 oForm.setConnectorType("HTTPS"); 89 } 90 } else { 91 oForm.setConnectorType("????"); 92 } 93 oForm.setAllowTrace(getBooleanAttribute(oObjectName, "allowTrace")); 95 oForm.setEmptySessionPath(getBooleanAttribute(oObjectName, "emptySessionPath")); 96 oForm.setEnableLookups(getBooleanAttribute(oObjectName, "enableLookups")); 97 oForm.setMaxPostSizeText(toStringIntegerAttribute(oObjectName, "maxPostSize")); 98 oForm.setProtocol(getStringAttribute(oObjectName, "protocol")); 99 oForm.setProxyName(getStringAttribute(oObjectName, "proxyName")); 100 oForm.setProxyPortText(toStringIntegerAttribute(oObjectName, "proxyPort")); 101 oForm.setRedirectPortText(toStringIntegerAttribute(oObjectName, "redirectPort")); 102 oForm.setScheme(getStringAttribute(oObjectName, "scheme")); 103 oForm.setSecure(getBooleanAttribute(oObjectName, "secure")); 104 oForm.setURIEncoding(getStringAttribute(oObjectName, "URIEncoding")); 105 oForm.setUseBodyEncodingForURI(getBooleanAttribute(oObjectName, "useBodyEncodingForURI")); 106 oForm.setXpoweredBy(getBooleanAttribute(oObjectName, "xpoweredBy")); 107 108 oForm.setAcceptCountText(toStringIntegerAttribute(oObjectName, "acceptCount")); 110 oForm.setAddress(getStringAttribute(oObjectName, "address")); 111 oForm.setPortText(toStringIntegerAttribute(oObjectName, "port")); 112 oForm.setRedirectPortText(toStringIntegerAttribute(oObjectName, "redirectPort")); 113 oForm.setTcpNoDelay(getBooleanAttribute(oObjectName, "tcpNoDelay")); 114 oForm.setMaxThreadsText(toStringIntegerAttribute(oObjectName, "maxThreads")); 116 oForm.setMinSpareThreadsText(toStringIntegerAttribute(oObjectName, "minSpareThreads")); 117 oForm.setMaxSpareThreadsText(toStringIntegerAttribute(oObjectName, "maxSpareThreads")); 118 119 if (!("AJP".equalsIgnoreCase(oForm.getConnectorType()))) { 121 oForm.setBufferSizeText(toStringIntegerAttribute(oObjectName, "bufferSize")); 122 oForm.setCompression(getStringAttribute(oObjectName, "compression")); 123 oForm.setConnectionLingerText(toStringIntegerAttribute(oObjectName, "connectionLingerText")); 124 oForm.setConnTimeOutText(toStringIntegerAttribute(oObjectName, "connectionTimeout")); 125 oForm.setConnectionUploadTimeoutText(toStringIntegerAttribute(oObjectName, "connectionUploadTimeout")); 126 oForm.setDisableUploadTimeout(getBooleanAttribute(oObjectName, "disableUploadTimeout")); 127 oForm.setMaxHttpHeaderSizeText(toStringIntegerAttribute(oObjectName, "maxHttpHeaderSize")); 128 oForm.setMaxKeepAliveRequestsText(toStringIntegerAttribute(oObjectName, "maxKeppAliveRequests")); 129 oForm.setStrategy(getStringAttribute(oObjectName, "strategy")); 130 oForm.setThreadPriorityText(toStringIntegerAttribute(oObjectName, "threadPriority")); 131 } 132 if (oForm.getConnectorType() == "AJP") { 134 oForm.setTomcatAuthentication(getBooleanAttribute(oObjectName, "tomcatAuthentication")); 135 } 136 if ("HTTPS".equalsIgnoreCase(oForm.getConnectorType())) { 138 oForm.setAlgorithm(getStringAttribute(oObjectName, "algorithm")); 140 oForm.setClientAuth(getBooleanAttribute(oObjectName, "clientAuth")); 141 oForm.setKeystoreFile(getStringAttribute(oObjectName, "keystoreFile")); 142 oForm.setKeystorePass(getStringAttribute(oObjectName, "keystorePass")); 143 oForm.setKeystoreType(getStringAttribute(oObjectName, "keystoreType")); 144 oForm.setSslProtocol(getStringAttribute(oObjectName, "sslProtocol")); 145 oForm.setCiphers(getStringAttribute(oObjectName, "ciphers")); 146 } 147 148 String nodeName = getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 150 + "protocols" + WhereAreYou.NODE_SEPARATOR 151 + "connectors" + WhereAreYou.NODE_SEPARATOR 152 + m_WhereAreYou.getCurrentCatalinaDomainName() + WhereAreYou.NODE_SEPARATOR 153 + oForm.getPortText(); 154 m_WhereAreYou.selectNameNode(nodeName, true); 155 } catch (Throwable t) { 156 addGlobalError(t); 157 saveErrors(pRequest, m_Errors); 158 return (pMapping.findForward("Global Error")); 159 } 160 return (pMapping.findForward("Catalina Connector")); 162 } 163 } 164 | Popular Tags |