1 16 17 package org.apache.webapp.admin.context; 18 19 import java.io.IOException ; 20 import java.util.Locale ; 21 import javax.servlet.ServletException ; 22 import javax.servlet.http.HttpServletRequest ; 23 import javax.servlet.http.HttpServletResponse ; 24 import javax.servlet.http.HttpSession ; 25 import org.apache.struts.action.Action; 26 import org.apache.struts.action.ActionForm; 27 import org.apache.struts.action.ActionForward; 28 import org.apache.struts.action.ActionMapping; 29 import org.apache.struts.util.MessageResources; 30 import org.apache.webapp.admin.Lists; 31 import org.apache.webapp.admin.TomcatTreeBuilder; 32 38 39 public class AddContextAction extends Action { 40 41 43 58 public ActionForward execute(ActionMapping mapping, 59 ActionForm form, 60 HttpServletRequest request, 61 HttpServletResponse response) 62 throws IOException , ServletException { 63 64 HttpSession session = request.getSession(); 66 Locale locale = getLocale(request); 67 MessageResources resources = getResources(request); 68 69 ContextForm contextFm = new ContextForm(); 71 session.setAttribute("contextForm", contextFm); 72 contextFm.setAdminAction("Create"); 73 contextFm.setObjectName(""); 74 String parent = request.getParameter("parent"); 75 contextFm.setParentObjectName(parent); 76 int i = parent.indexOf(":"); 77 String domain = parent.substring(0, i); 78 int position = parent.indexOf(","); 79 String loader = domain + TomcatTreeBuilder.LOADER_TYPE + 80 parent.substring(position, parent.length()); 81 String manager = domain + TomcatTreeBuilder.MANAGER_TYPE + 82 parent.substring(position, parent.length()); 83 contextFm.setLoaderObjectName(loader); 84 contextFm.setManagerObjectName(manager); 85 contextFm.setNodeLabel(""); 86 contextFm.setCookies(""); 87 contextFm.setCrossContext("false"); 88 contextFm.setDocBase(""); 89 contextFm.setOverride("false"); 90 contextFm.setPrivileged("false"); 91 contextFm.setPath(""); 92 contextFm.setReloadable("false"); 93 contextFm.setSwallowOutput("false"); 94 contextFm.setUseNaming("false"); 95 contextFm.setWorkDir(""); 96 contextFm.setPath(""); 97 contextFm.setLdrReloadable("false"); 100 contextFm.setMgrMaxSessions("-1"); 103 contextFm.setMgrSessionIDInit(""); 104 105 contextFm.setBooleanVals(Lists.getBooleanValues()); 106 107 return (mapping.findForward("Context")); 109 110 } 111 } 112 | Popular Tags |