1 16 17 package org.apache.webapp.admin.connector; 18 19 import java.io.IOException ; 20 import java.net.URLEncoder ; 21 import java.util.Locale ; 22 import java.util.ArrayList ; 23 import javax.servlet.ServletException ; 24 import javax.servlet.http.HttpServletRequest ; 25 import javax.servlet.http.HttpServletResponse ; 26 import javax.servlet.http.HttpSession ; 27 import org.apache.struts.action.Action; 28 import org.apache.struts.action.ActionErrors; 29 import org.apache.struts.action.ActionForm; 30 import org.apache.struts.action.ActionForward; 31 import org.apache.struts.action.ActionMapping; 32 import org.apache.struts.util.MessageResources; 33 import org.apache.webapp.admin.TomcatTreeBuilder; 34 import org.apache.webapp.admin.LabelValueBean; 35 import org.apache.webapp.admin.Lists; 36 37 43 44 public class AddConnectorAction extends Action { 45 46 47 49 64 public ActionForward execute(ActionMapping mapping, 65 ActionForm form, 66 HttpServletRequest request, 67 HttpServletResponse response) 68 throws IOException , ServletException { 69 70 HttpSession session = request.getSession(); 72 73 String serviceName = request.getParameter("select"); 76 77 ConnectorForm connectorFm = new ConnectorForm(); 79 session.setAttribute("connectorForm", connectorFm); 80 connectorFm.setAdminAction("Create"); 81 connectorFm.setObjectName(""); 82 connectorFm.setConnectorName(""); 83 String type = request.getParameter("type"); 84 if (type == null) 85 type = "HTTP"; connectorFm.setConnectorType(type); 87 connectorFm.setServiceName(serviceName); 88 if ("HTTPS".equalsIgnoreCase(type)) { 89 connectorFm.setScheme("https"); 90 } else { 91 connectorFm.setScheme("http"); 92 } 93 connectorFm.setAcceptCountText("10"); 94 connectorFm.setCompression("off"); 95 connectorFm.setConnLingerText("-1"); 96 connectorFm.setConnTimeOutText("60000"); 97 connectorFm.setConnUploadTimeOutText("300000"); 98 connectorFm.setBufferSizeText("2048"); 99 connectorFm.setDisableUploadTimeout("false"); 100 connectorFm.setEnableLookups("true"); 101 connectorFm.setAddress(""); 102 connectorFm.setPortText(""); 103 connectorFm.setRedirectPortText("-1"); 104 connectorFm.setMinProcessorsText("5"); 105 connectorFm.setMaxProcessorsText("20"); 106 connectorFm.setMaxKeepAliveText("100"); 107 connectorFm.setMaxSpare("50"); 108 connectorFm.setMaxThreads("200"); 109 connectorFm.setMinSpare("4"); 110 connectorFm.setThreadPriority(String.valueOf(Thread.NORM_PRIORITY)); 111 connectorFm.setSecure("false"); 112 connectorFm.setTcpNoDelay("true"); 113 connectorFm.setXpoweredBy("false"); 114 115 connectorFm.setAlgorithm("SunX509"); 117 connectorFm.setClientAuthentication("false"); 118 connectorFm.setCiphers(""); 119 connectorFm.setKeyStoreFileName(""); 120 connectorFm.setKeyStorePassword(""); 121 connectorFm.setKeyStoreType("JKS"); 122 connectorFm.setSslProtocol("TLS"); 123 124 connectorFm.setProxyName(""); 126 connectorFm.setProxyPortText("0"); 127 128 connectorFm.setBooleanVals(Lists.getBooleanValues()); 129 connectorFm.setClientAuthVals(Lists.getClientAuthValues()); 130 131 String schemeTypes[]= new String [3]; 132 schemeTypes[0] = "HTTP"; 133 schemeTypes[1] = "HTTPS"; 134 schemeTypes[2] = "AJP"; 135 136 ArrayList types = new ArrayList (); 137 types.add(new LabelValueBean(type, 139 "AddConnector.do?select=" + 140 URLEncoder.encode(serviceName,TomcatTreeBuilder.URL_ENCODING) 141 + "&type=" + type)); 142 for (int i=0; i< schemeTypes.length; i++) { 143 if (!type.equalsIgnoreCase(schemeTypes[i])) { 144 types.add(new LabelValueBean(schemeTypes[i], 145 "AddConnector.do?select=" + 146 URLEncoder.encode(serviceName,TomcatTreeBuilder.URL_ENCODING) 147 + "&type=" + schemeTypes[i])); 148 } 149 } 150 connectorFm.setConnectorTypeVals(types); 151 152 return (mapping.findForward("Connector")); 154 155 } 156 } 157 | Popular Tags |