patrickl 02/01/17 21:53:26 Modified: webapps/admin host.jsp webapps/admin/WEB-INF struts-config.xml webapps/admin/WEB-INF/classes/org/apache/webapp/admin ApplicationResources_en.properties ApplicationResources_es.properties TomcatTreeBuilder.java Added: webapps/admin context.jsp webapps/admin/WEB-INF/classes/org/apache/webapp/admin ContextAction.java ContextForm.java SetUpContextAction.java Log: Added Context viewing/editing functionality. Values read/written to corresponding Context mBean. Submitted by: Manveen Kaur Revision Changes Path 1.2 +1 -1 jakarta-tomcat-4.0/webapps/admin/host.jsp Index: host.jsp =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/host.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- host.jsp 10 Jan 2002 03:41:13 -0000 1.1 +++ host.jsp 18 Jan 2002 05:53:26 -0000 1.2 @@ -51,7 +51,7 @@ <controls:action url=""> <bean:message key="actions.valve.create"/> </controls:action> <controls:action url=""> <bean:message key="actions.valve.delete"/> </controls:action> <controls:action> ------------------------------------- </controls:action> - <controls:action url=""> <bean:message key="actions.host.delete"/> </controls:action> + <controls:action url=""> <bean:message key="actions.thishost.delete"/> </controls:action> </controls:actions> </div> </td> 1.1 jakarta-tomcat-4.0/webapps/admin/context.jsp Index: context.jsp =================================================================== <!-- Standard Struts Entries --> <%@ page language="java" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/controls.tld" prefix="controls" %> <html:html locale="true"> <%@ include file="header.jsp" %> <!-- Body --> <body bgcolor="white"> <!--Form --> <html:errors/> <html:form method="POST" action="/context"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="7171A5"> <td width="81%"> <html:hidden property="contextName"/> <div class="page-title-text" align="left"> <bean:write name="contextForm" property="nodeLabel" scope="session"/> </div> </td> <td width="19%"> <div align="right"> <controls:actions> <controls:action selected="true"> ----<bean:message key="actions.available.actions"/>---- </controls:action> <controls:action> --------------------------------- </controls:action> <controls:action url=""> <bean:message key="actions.logger.create"/> </controls:action> <controls:action url=""> <bean:message key="actions.logger.delete"/> </controls:action> <controls:action> ------------------------------------- </controls:action> <controls:action url=""> <bean:message key="actions.requestfilter.create"/> </controls:action> <controls:action url=""> <bean:message key="actions.requestfilter.delete"/> </controls:action> <controls:action> ------------------------------------- </controls:action> <controls:action url=""> <bean:message key="actions.userrealm.create"/> </controls:action> <controls:action url=""> <bean:message key="actions.userrealm.delete"/> </controls:action> <controls:action> ------------------------------------- </controls:action> <controls:action url=""> <bean:message key="actions.valve.create"/> </controls:action> <controls:action url=""> <bean:message key="actions.valve.delete"/> </controls:action> <controls:action> --------------------------------- </controls:action> <!-- will add the urls later once those screens get implemented --> <controls:action url=""> <bean:message key="actions.thiscontext.delete"/> </controls:action> </controls:actions> </div> </td> </tr> </table> <%@ include file="buttons.jsp" %> <br> <%-- Context Properties table --%> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> <div class="table-title-text"> <bean:message key="context.properties"/> </div> </td> </tr> </table> <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> <controls:table tableStyle="front-table" lineStyle="line-row"> <controls:row header="true" labelStyle="table-header-text" dataStyle="table-header-text"> <controls:label><bean:message key="service.property"/></controls:label> <controls:data><bean:message key="service.value"/></controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.cookies"/>:</controls:label> <controls:data> <html:select property="cookies"> <bean:define id="booleanVals" name="contextForm" property="booleanVals"/> <html:options collection="booleanVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.cross.context"/>:</controls:label> <controls:data> <html:select property="crossContext"> <bean:define id="booleanVals" name="contextForm" property="booleanVals"/> <html:options collection="booleanVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="server.debuglevel"/>:</controls:label> <controls:data> <html:select property="debugLvl"> <bean:define id="debugLvlVals" name="contextForm" property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.docBase"/>:</controls:label> <controls:data> <html:text property="docBase" size="30"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.override"/>:</controls:label> <controls:data> <html:select property="override"> <bean:define id="booleanVals" name="contextForm" property="booleanVals"/> <html:options collection="booleanVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.path"/>:</controls:label> <controls:data> <html:text property="path" size="30"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.reloadable"/>:</controls:label> <controls:data> <html:select property="reloadable"> <bean:define id="booleanVals" name="contextForm" property="booleanVals"/> <html:options collection="booleanVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.usenaming"/>:</controls:label> <controls:data> <html:select property="useNaming"> <bean:define id="booleanVals" name="contextForm" property="booleanVals"/> <html:options collection="booleanVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.workdir"/>:</controls:label> <controls:data> <html:text property="workDir" size="30"/> </controls:data> </controls:row> </controls:table> </td> </tr> </table> <br> <%-- Loader Properties table --%> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> <div class="table-title-text"> <bean:message key="context.loader.properties"/> </div> </td> </tr> </table> <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> <controls:table tableStyle="front-table" lineStyle="line-row"> <controls:row header="true" labelStyle="table-header-text" dataStyle="table-header-text"> <controls:label><bean:message key="service.property"/></controls:label> <controls:data><bean:message key="service.value"/></controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.checkInterval"/>:</controls:label> <controls:data> <html:text property="ldrCheckInterval" size="5"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="server.debuglevel"/>:</controls:label> <controls:data> <html:select property="ldrDebugLvl"> <bean:define id="debugLvlVals" name="contextForm" property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.reloadable"/>:</controls:label> <controls:data> <html:select property="ldrReloadable"> <bean:define id="booleanVals" name="contextForm" property="booleanVals"/> <html:options collection="booleanVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> </controls:table> </td> </tr> </table> <%-- Session Manager Properties table --%> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> <div class="table-title-text"> <bean:message key="context.sessionmgr.properties"/> </div> </td> </tr> </table> <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> <controls:table tableStyle="front-table" lineStyle="line-row"> <controls:row header="true" labelStyle="table-header-text" dataStyle="table-header-text"> <controls:label><bean:message key="service.property"/></controls:label> <controls:data><bean:message key="service.value"/></controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.checkInterval"/>:</controls:label> <controls:data> <html:text property="mgrCheckInterval" size="5"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="server.debuglevel"/>:</controls:label> <controls:data> <html:select property="mgrDebugLvl"> <bean:define id="debugLvlVals" name="contextForm" property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.sessionId"/>:</controls:label> <controls:data> <html:text property="mgrSessionIDInit" size="20"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="context.max.sessions"/>:</controls:label> <controls:data> <html:text property="mgrMaxSessions" size="5"/> </controls:data> </controls:row> </controls:table> </td> </tr> </table> <%@ include file="buttons.jsp" %> <br> </html:form> <p> </p> </body> </html:html> 1.15 +27 -1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml Index: struts-config.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- struts-config.xml 10 Jan 2002 03:41:13 -0000 1.14 +++ struts-config.xml 18 Jan 2002 05:53:26 -0000 1.15 @@ -31,6 +31,10 @@ <form-bean name="hostForm" type="org.apache.webapp.admin.HostForm"/> + <!-- Context form bean --> + <form-bean name="contextForm" + type="org.apache.webapp.admin.ContextForm"/> + <!-- Set Locale form bean --> <form-bean name="setLocaleForm" type="org.apache.webapp.admin.SetLocaleForm"/> @@ -73,7 +77,11 @@ <forward name="Host" path="/host.jsp" redirect="false"/> - + + <forward name="Context" + path="/context.jsp" + redirect="false"/> + <forward name="Save Successful" path="/saved.jsp" redirect="false"/> @@ -142,6 +150,16 @@ redirect="true"/> </action> + <!-- Set up Context datastructure --> + <action path="/setUpContext" + type="org.apache.webapp.admin.SetUpContextAction" + name="contextForm" + scope="session"> + <forward name="SetUpContext" + path="/context.jsp" + redirect="true"/> + </action> + <!-- Log out of the application --> <action path="/logOut" type="org.apache.webapp.admin.LogOutAction"> @@ -180,6 +198,14 @@ name="hostForm" scope="session" input="/host.jsp"> + </action> + + <!-- Process a context change --> + <action path="/context" + type="org.apache.webapp.admin.ContextAction" + name="contextForm" + scope="session" + input="/context.jsp"> </action> <!-- Process a set-locale action --> 1.13 +31 -1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties Index: ApplicationResources_en.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ApplicationResources_en.properties 10 Jan 2002 03:41:13 -0000 1.12 +++ ApplicationResources_en.properties 18 Jan 2002 05:53:26 -0000 1.13 @@ -83,7 +83,8 @@ actions.thisconnector.delete=Delete This connector actions.alias.create=Create New Aliases actions.alias.delete=Delete Aliases -actions.host.delete=Delete This Host +actions.thishost.delete=Delete This Host +actions.thiscontext.delete=Delete This Context connector.type=Type connector.accept.count=Accept Count connector.connection.timeout=Connection Timeout @@ -101,3 +102,32 @@ host.wars=Unpack WARs host.aliases=Aliases host.alias.name=Alias Name +context.properties=Context Properties +context.cookies=Cookies +context.cross.context=Cross Context +context.docBase=Document Base +context.override=Override +context.path=Path +context.reloadable=Reloadable +context.usenaming=Use Naming +context.workdir=Working Directory +context.loader.properties=Loader Properties +context.sessionmgr.properties=Session Manager Properties +context.checkInterval=Check interval +context.sessionId=Session ID Initializer +context.max.sessions=Maximum Active Sessions +error.docBase.required=<li>Document base cannot be null</li> +error.path.required=<li>Path cannot be null</li> +error.workDir.required=<li>Working directory cannot be null</li> +error.ldrCheckInterval.required=<li>Loader check interval cannot be empty</li> +error.ldrCheckInterval.format=<li>Loader check interval not a valid integer!</li> +error.ldrCheckInterval.range=<li>Loader check interval seems out of range. Valid range is 1-1000. </li> +error.mgrCheckInterval.required=<li>Manager check interval cannot be empty</li> +error.mgrCheckInterval.format=<li>Manager check interval not a valid integer!</li> +error.mgrCheckInterval.range=<li>Manager check interval seems out of range. Valid range is 1-1000. </li> +error.mgrSessionIDInit.required=<li>Session Manager Initialization ID cannot be empty</li> +error.mgrSessionIDInit.format=<li>Session Manager Initialization ID not a valid integer!</li> +error.mgrSessionIDInit.range=<li>Session Manager Initialization ID seems out of range. Valid range is 1-1000. </li> +error.mgrMaxSessions.required=<li>Maximum sessions cannot be empty</li> +error.mgrMaxSessions.format=<li>Maximum sessions not a valid integer!</li> +error.mgrMaxSessions.range=<li>Maximum sessions seems out of range. Valid range is -1 to 100. </li> 1.16 +32 -2 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties Index: ApplicationResources_es.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ApplicationResources_es.properties 10 Jan 2002 03:41:13 -0000 1.15 +++ ApplicationResources_es.properties 18 Jan 2002 05:53:26 -0000 1.16 @@ -83,7 +83,8 @@ actions.thisconnector.delete=Eliminar este conector actions.alias.create=Cree Los Nuevos Pseudonimos actions.alias.delete=Pseudonimos De la Cancelacion -actions.host.delete=Suprima Este Ordenador principal +actions.thishost.delete=Suprima Este Ordenador principal +actions.thiscontext.delete=Suprima Este Contexto connector.type=Tipo connector.accept.count=Valide La Cuenta connector.connection.timeout=Descanso De la Conexi\u00f3n @@ -95,9 +96,38 @@ connector.max=Maximo connector.proxy.name=Nombre del Proxy connector.proxy.portnumber=Numero de Puerto del Proxy -host.properties=Caracteristicas Del Ordenador principal +host.properties=Propiedades del ordenador principal host.name=Nombre host.base=Base De la Aplicacion host.wars=Desempaquete WARs host.aliases=Pseudonimos host.alias.name=Alias Nombre +context.properties=Propiedades del contexto +context.cookies=Cookies +context.cross.context=Cross Context +context.docBase=Base Del Documento +context.override=Invalidacion +context.path=Camino +context.reloadable=Reloadable +context.usenaming=Utilice El Nombramiento +context.workdir=Directorio De Funcionamiento +context.loader.properties=Propiedades del cargador +context.sessionmgr.properties=Propiedades del encargado de la Sesion +context.checkInterval=Controle el intervalo +context.sessionId=Inicializador De la Identificacion De la Sesion +context.max.sessions=Sesiones Activas Del Maximo +error.docBase.required=<li>La base del documento no puede ser nula</li> +error.path.required=<li>El camino no puede ser nulo</li> +error.workDir.required=<li>El directorio de funcionamiento no puede ser nulo</li> +error.ldrCheckInterval.required=<li>El intervalo del cheque del cargador no puede ser vacio</li> +error.ldrCheckInterval.format=<li>Intervalo del cheque del cargador no un numero entero valido!</li> +error.ldrCheckInterval.range=<li>El intervalo del cheque del cargador se parece fuera de rango. El rango valido es 1-1000.</li> +error.mgrCheckInterval.required=<li>El intervalo del cheque del encargado no puede ser vacio</li> +error.mgrCheckInterval.format=<li>Intervalo del cheque del encargado no un numero entero valido!</li> +error.mgrCheckInterval.range=<li>El intervalo del cheque del encargado se parece fuera de rango. El rango validoes 1-1000.</li> +error.mgrSessionIDInit.required=<li>La identificacion de la inicializacion del encargado de la sesion no puede servica</li> +error.mgrSessionIDInit.format=<li>Identificacion de la inicializacion del encargado de la sesion no un numero entero valido!</li> +error.mgrSessionIDInit.range=<li>La identificacion de la inicializacion del encargado de la sesion se parece fuera de rango. El rango valido es 1-1000. </li> +error.mgrMaxSessions.required=<li>Las sesiones maximas no pueden ser vacias</li> +error.mgrMaxSessions.format=<li>Sesiones maximas no un numero entero valido!</li> +error.mgrMaxSessions.range=<li>Las sesiones maximas se parecen fuera de rango. El rango valido es -1 a 100.</li> 1.7 +64 -20 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java Index: TomcatTreeBuilder.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TomcatTreeBuilder.java 10 Jan 2002 20:34:04 -0000 1.6 +++ TomcatTreeBuilder.java 18 Jan 2002 05:53:26 -0000 1.7 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v 1.6 2002/01/10 20:34:04 patrickl Exp $ - * $Revision: 1.6 $ - * $Date: 2002/01/10 20:34:04 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v 1.7 2002/01/18 05:53:26 patrickl Exp $ + * $Revision: 1.7 $ + * $Date: 2002/01/18 05:53:26 $ * * ==================================================================== * @@ -91,7 +91,7 @@ * * @author Jazmin Jonson * @author Manveen Kaur - * @version $Revision: 1.6 $ $Date: 2002/01/10 20:34:04 $ + * @version $Revision: 1.7 $ $Date: 2002/01/18 05:53:26 $ */ @@ -105,6 +105,10 @@ public final static String ENGINE_TYPE = "Catalina:type=Engine"; public final static String CONNECTOR_TYPE = "Catalina:type=Connector"; public final static String HOST_TYPE = "Catalina:type=Host"; + public final static String CONTEXT_TYPE = "Catalina:type=Context"; + public final static String LOADER_TYPE = "Catalina:type=WebappLoader"; + public final static String MANAGER_TYPE = "Catalina:type=StandardManager"; + public final static String WILDCARD = ",*"; private static MBeanServer mBServer = null; @@ -178,7 +182,7 @@ String nodeLabel = "Service (" + serviceName + ")"; String encodedNodeLabel = URLEncoder.encode(nodeLabel); - + TreeControlNode serviceNode = new TreeControlNode(service.getObjectName().toString(), "folder_16_pad.gif", @@ -225,7 +229,7 @@ if (!"warp".equalsIgnoreCase(connectorName)) { connectorNode = new TreeControlNode(connectorObj.getObjectName().toString(), - "folder_16_pad.gif", + "folder_16_pad.gif", nodeLabel, "setUpConnector.do?select=" + encodedConnectorName + "&nodeLabel="+ encodedNodeLabel, @@ -239,18 +243,7 @@ public void getHosts(TreeControlNode serviceNode, String serviceName) throws JMException{ - - /* - System.out.println("** There are " + mBServer.getMBeanCount().intValue() + - " registered MBeans **"); - Iterator instances = mBServer.queryMBeans(null, null).iterator(); - while (instances.hasNext()) { - ObjectInstance instance = (ObjectInstance) instances.next(); - System.out.println(" objectName=" + instance.getObjectName() + - ", className=" + instance.getClassName()); - } - */ - + Iterator HostItr = (mBServer.queryMBeans(new ObjectName(HOST_TYPE + WILDCARD + ",service=" + serviceName), null)).iterator(); @@ -270,7 +263,7 @@ String nodeLabel="Host (" + hostName + ")"; String encodedNodeLabel = URLEncoder.encode(nodeLabel); - + hostNode = new TreeControlNode(hostObj.getObjectName().toString(), "folder_16_pad.gif", @@ -280,6 +273,57 @@ "content", true); serviceNode.addChild(hostNode); - } + + getContexts(hostNode, hostName, serviceName); + } + + } + + public void getContexts(TreeControlNode hostNode, String hostName, String serviceName) + throws JMException{ + + /* + System.out.println("** There are " + mBServer.getMBeanCount().intValue() + + " registered MBeans **"); + Iterator instances = mBServer.queryMBeans(null, null).iterator(); + while (instances.hasNext()) { + ObjectInstance instance = (ObjectInstance) instances.next(); + System.out.println(" objectName=" + instance.getObjectName() + + ", className=" + instance.getClassName()); + } + */ + + Iterator contextItr = + (mBServer.queryMBeans(new ObjectName(CONTEXT_TYPE + WILDCARD + + ",host=" + hostName + ",service=" + serviceName), null)).iterator(); + + TreeControlNode contextNode = null; + String encodedContextName; + + while(contextItr.hasNext()){ + + ObjectInstance contextObj = (ObjectInstance)contextItr.next(); + + String contextName = + (String)mBServer.getAttribute(contextObj.getObjectName(), + "name"); + + encodedContextName = URLEncoder.encode(contextObj.getObjectName().toString()); + + String nodeLabel="Context (" + contextName + ")"; + String encodedNodeLabel = URLEncoder.encode(nodeLabel); + + contextNode = + new TreeControlNode(contextObj.getObjectName().toString(), + "folder_16_pad.gif", + nodeLabel, + "setUpContext.do?select=" + encodedContextName + +"&nodeLabel="+ encodedNodeLabel, + "content", true); + + hostNode.addChild(contextNode); + + } + } } 1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ContextAction.java Index: ContextAction.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ContextAction.java,v 1.1 2002/01/18 05:53:26 patrickl Exp $ * $Revision: 1.1 $ * $Date: 2002/01/18 05:53:26 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import java.util.Iterator; import java.util.Locale; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.management.Attribute; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.QueryExp; import javax.management.Query; import javax.management.ObjectInstance; import javax.management.ObjectName; import javax.management.JMException; import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; import javax.management.MBeanInfo; import org.apache.struts.util.MessageResources; /** * Implementation of <strong>Action</strong> that validates * actions on a Context. * * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2002/01/18 05:53:26 $ */ public final class ContextAction extends Action { private static MBeanServer mBServer = null; // --------------------------------------------------------- Public Methods /** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param actionForm The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception occurs */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try{ // front end validation and checking. // =================================================== MessageResources messages = getResources(); Locale locale = (Locale)request.getSession().getAttribute(Action.LOCALE_KEY); // Validate the request parameters specified by the user ActionErrors errors = new ActionErrors(); // Report any errors we have discovered back to the original form if (!errors.empty()) { saveErrors(request, errors); return (new ActionForward(mapping.getInput())); } if(mBServer == null) { ApplicationServlet servlet = (ApplicationServlet)getServlet(); mBServer = servlet.getServer(); } /** * Get the context Name from the form. * This is used to lookup the MBeanServer and * retrieve this context's MBean. */ String contextName = request.getParameter("contextName"); Iterator contextItr = mBServer.queryMBeans(new ObjectName(contextName), null).iterator(); ObjectInstance objInstance = (ObjectInstance)contextItr.next(); ObjectName contextObjName = (objInstance).getObjectName(); /** * Extracting the values from the form and * updating the MBean with the new values. */ String cookiesText = request.getParameter("cookies"); if(cookiesText != null) { Boolean cookies = Boolean.valueOf(cookiesText); mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.COOKIES_PROP_NAME, cookies)); } String crossContextText = request.getParameter("crossContext"); if(crossContextText != null) { Boolean crossContext = Boolean.valueOf(crossContextText); mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.CROSS_CONTEXT_PROP_NAME, crossContext)); } String debugLvlText = request.getParameter("debugLvl"); if(debugLvlText != null) { Integer debugLvl = new Integer(debugLvlText); mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.DEBUG_PROP_NAME, debugLvl)); } String docBase = request.getParameter("docBase"); if(docBase != null) { mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.DOC_BASE_PROP_NAME, docBase)); } String overrideText = request.getParameter("override"); if(overrideText != null) { Boolean override = Boolean.valueOf(overrideText); mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.OVERRIDE_PROP_NAME, override)); } String path = request.getParameter("path"); if(path != null) { mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.PATH_PROP_NAME, path)); } String reloadableText = request.getParameter("reloadable"); if(reloadableText != null) { Boolean reloadable = Boolean.valueOf(reloadableText); mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.RELOADABLE_PROP_NAME, reloadable)); } String useNamingText = request.getParameter("useNaming"); if(useNamingText != null) { Boolean useNaming = Boolean.valueOf(useNamingText); mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.USENAMING_PROP_NAME, useNaming)); } String workDir = request.getParameter("workDir"); if(workDir != null) { mBServer.setAttribute(contextObjName, new Attribute(SetUpContextAction.WORKDIR_PROP_NAME, workDir)); } // FIXME // Need to write loader and session mgr properties back // once their mBeans are available through code! }catch(Throwable t){ t.printStackTrace(System.out); //forward to error page } if (servlet.getDebug() >= 1) servlet.log(" Forwarding to success page"); // Forward back to the test page return (mapping.findForward("Save Successful")); } } 1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ContextForm.java Index: ContextForm.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ContextForm.java,v 1.1 2002/01/18 05:53:26 patrickl Exp $ * $Revision: 1.1 $ * $Date: 2002/01/18 05:53:26 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import java.net.InetAddress; import java.util.ArrayList; /** * Form bean for the context page. * * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2002/01/18 05:53:26 $ */ public final class ContextForm extends ActionForm { // ----------------------------------------------------- Instance Variables /** * The text for the scheme. */ //private String scheme = null; /** * The text for the node label. */ private String nodeLabel = null; /** * The value of cookies. */ private String cookies = "false"; /** * The value of cross context. */ private String crossContext = "false"; /** * The text for the debug level. */ private String debugLvl = "0"; /** * The text for the document Base. */ private String docBase = null; /** * The text for override boolean. */ private String override = "false"; /** * The text for the context path for this context. */ private String path = null; /** * The text for reloadable boolean. */ private String reloadable = "false"; /** * The text for use naming boolean. */ private String useNaming = "false"; /** * The text for the working directory for this context. */ private String workDir = null; /** * The text for the loader check interval. */ private String ldrCheckInterval = "0"; /** * The text for the loader Debug level. */ private String ldrDebugLvl = "0"; /** * The text for the boolean value of loader reloadable. */ private String ldrReloadable = "false"; /** * The text for the session manager check interval. */ private String mgrCheckInterval = "0"; /** * The text for the session manager Debug level. */ private String mgrDebugLvl = "0"; /** * The text for the session mgr session ID initializer. */ private String mgrSessionIDInit = "0"; /** * The text for the session mgr max active sessions. */ private String mgrMaxSessions = "0"; /** * The text for the contextName. */ private String contextName = null; /** * Set of valid values for debug level. */ private ArrayList debugLvlVals = null; /* * Represent boolean (true, false) values for cookies etc. */ private ArrayList booleanVals = null; // ------------------------------------------------------------- Properties /** * Return the label of the node that was clicked. */ public String getNodeLabel() { return this.nodeLabel; } /** * Set the node label. */ public void setNodeLabel(String nodeLabel) { this.nodeLabel = nodeLabel; } /** * Return the debugVals. */ public ArrayList getDebugLvlVals() { return this.debugLvlVals; } /** * Set the debugVals. */ public void setDebugLvlVals(ArrayList debugLvlVals) { this.debugLvlVals = debugLvlVals; } /** * Return the booleanVals. */ public ArrayList getBooleanVals() { return this.booleanVals; } /** * Set the debugVals. */ public void setBooleanVals(ArrayList booleanVals) { this.booleanVals = booleanVals; } /** * Return the Cookies. */ public String getCookies() { return this.cookies; } /** * Set the Cookies. */ public void setCookies(String cookies) { this.cookies = cookies; } /** * Return the Cross Context. */ public String getCrossContext() { return this.crossContext; } /** * Set the Cross Context. */ public void setCrossContext(String crossContext) { this.crossContext = crossContext; } /** * Return the Debug Level Text. */ public String getDebugLvl() { return this.debugLvl; } /** * Set the Debug Level Text. */ public void setDebugLvl(String debugLvl) { this.debugLvl = debugLvl; } /** * Return the Document Base Text. */ public String getDocBase() { return this.docBase; } /** * Set the document Base text. */ public void setDocBase(String docBase) { this.docBase = docBase; } /** * Return the Override boolean value. */ public String getOverride() { return this.override; } /** * Set the override value. */ public void setOverride(String override) { this.override = override; } /** * Return the context path. */ public String getPath() { return this.path; } /** * Set the context path text. */ public void setPath(String path) { this.path = path; } /** * Return the reloadable boolean value. */ public String getReloadable() { return this.reloadable; } /** * Set the reloadable value. */ public void setReloadable(String reloadable) { this.reloadable = reloadable; } /** * Return the use naming boolean value. */ public String getUseNaming() { return this.useNaming; } /** * Set the useNaming value. */ public void setUseNaming(String useNaming) { this.useNaming = useNaming; } /** * Return the Working Directory. */ public String getWorkDir() { return this.workDir; } /** * Set the working directory. */ public void setWorkDir(String workDir) { this.workDir = workDir; } /** * Return the loader check interval. */ public String getLdrCheckInterval() { return this.ldrCheckInterval; } /** * Set the loader Check Interval. */ public void setLdrCheckInterval(String ldrCheckInterval) { this.ldrCheckInterval = ldrCheckInterval; } /** * Return the Loader Debug Level Text. */ public String getLdrDebugLvl() { return this.ldrDebugLvl; } /** * Set the Loader Debug Level Text. */ public void setLdrDebugLvl(String ldrDebugLvl) { this.ldrDebugLvl = ldrDebugLvl; } /** * Return the loader reloadable boolean value. */ public String getLdrReloadable() { return this.ldrReloadable; } /** * Set the loader reloadable value. */ public void setLdrReloadable(String ldrReloadable) { this.ldrReloadable = ldrReloadable; } /** * Return the session manager check interval. */ public String getMgrCheckInterval() { return this.mgrCheckInterval; } /** * Set the session manager Check Interval. */ public void setMgrCheckInterval(String mgrCheckInterval) { this.mgrCheckInterval = mgrCheckInterval; } /** * Return the session mgr Debug Level Text. */ public String getMgrDebugLvl() { return this.mgrDebugLvl; } /** * Set the session mgr Debug Level Text. */ public void setMgrDebugLvl(String mgrDebugLvl) { this.mgrDebugLvl = mgrDebugLvl; } /** * Return the session ID initializer. */ public String getMgrSessionIDInit() { return this.mgrSessionIDInit; } /** * Set the mgr Session ID Initizializer. */ public void setMgrSessionIDInit(String mgrSessionIDInit) { this.mgrSessionIDInit = mgrSessionIDInit; } /** * Return the Session mgr maximum active sessions. */ public String getMgrMaxSessions() { return this.mgrMaxSessions; } /** * Set the Session mgr maximum active sessions. */ public void setMgrMaxSessions(String mgrMaxSessions) { this.mgrMaxSessions = mgrMaxSessions; } /** * Return the Context Name. */ public String getContextName() { return this.contextName; } /** * Set the Context Name. */ public void setContextName(String contextName) { this.contextName = contextName; } // --------------------------------------------------------- Public Methods /** * Reset all properties to their default values. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { // context properties this.cookies = "false"; this.crossContext = "false"; this.debugLvl = "0"; this.docBase = null; this.override= "false"; this.path = null; this.reloadable = "false"; // loader properties this.ldrCheckInterval = "0"; this.ldrDebugLvl = "0"; this.ldrReloadable = "true"; // session manager properties this.mgrCheckInterval = "0"; this.mgrDebugLvl = "0"; this.mgrSessionIDInit = "0"; this.mgrMaxSessions = "-1"; } /** * Validate the properties that have been set from this HTTP request, * and return an <code>ActionErrors</code> object that encapsulates any * validation errors that have been found. If no errors are found, return * <code>null</code> or an <code>ActionErrors</code> object with no * recorded error messages. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ private ActionErrors errors; public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { errors = new ActionErrors(); String submit = request.getParameter("submit"); // front end validation when save is clicked. if (submit != null) { // docBase cannot be null if ((docBase == null) || (docBase.length() < 1)) { errors.add("docBase", new ActionError("error.docBase.required")); } if ((path == null) || (path.length() < 1)) { errors.add("path", new ActionError("error.path.required")); } if ((workDir == null) || (workDir.length() < 1)) { errors.add("workDir", new ActionError("error.workDir.required")); } // loader properties // FIXME-- verify if these ranges are ok. numberCheck("ldrCheckInterval", ldrCheckInterval , true, 0, 10000); // session manager properties numberCheck("mgrCheckInterval", mgrCheckInterval, true, 0, 10000); numberCheck("mgrSessionIDInit", mgrSessionIDInit, false, 0, 65535); numberCheck("mgrMaxSessions", mgrMaxSessions, false, -1, 100); } return errors; } /* * Helper method to check that it is a required number and * is a valid integer within the given range. (min, max). * * @param field The field name in the form for which this error occured. * @param numText The string representation of the number. * @param rangeCheck Boolean value set to true of reange check should be performed. * * @param min The lower limit of the range * @param max The upper limit of the range * */ private void numberCheck(String field, String numText, boolean rangeCheck, int min, int max) { // Check for 'is required' if ((numText == null) || (numText.length() < 1)) { errors.add(field, new ActionError("error."+field+".required")); } else { // check for 'must be a number' in the 'valid range' try { int num = Integer.parseInt(numText); // perform range check only if required if (rangeCheck) { if ((num < min) || (num > max )) errors.add( field, new ActionError("error."+ field +".range")); } } catch (NumberFormatException e) { errors.add(field, new ActionError("error."+ field + ".format")); } } } } 1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpContextAction.java Index: SetUpContextAction.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpContextAction.java,v 1.1 2002/01/18 05:53:26 patrickl Exp $ * $Revision: 1.1 $ * $Date: 2002/01/18 05:53:26 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR contextS; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.webapp.admin; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.Action; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.QueryExp; import javax.management.Query; import javax.management.ObjectInstance; import javax.management.ObjectName; import javax.management.JMException; import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; import javax.management.MBeanInfo; import javax.management.modelmbean.ModelMBean; import javax.management.modelmbean.ModelMBeanInfo; import org.apache.struts.util.MessageResources; /** * Test <code>Action</code> that handles events from the tree control when * a context is chosen. * * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2002/01/18 05:53:26 $ */ public class SetUpContextAction extends Action { private static MBeanServer mBServer = null; // ---- Context Properties ---- public final static String COOKIES_PROP_NAME = "cookies"; public final static String CROSS_CONTEXT_PROP_NAME = "crossContext"; public final static String DEBUG_PROP_NAME = "debug"; public final static String DOC_BASE_PROP_NAME = "docBase"; public final static String OVERRIDE_PROP_NAME = "override"; public final static String PATH_PROP_NAME = "name"; public final static String RELOADABLE_PROP_NAME = "reloadable"; public final static String USENAMING_PROP_NAME = "useNaming"; public final static String WORKDIR_PROP_NAME = "workDir"; // -- Loader properties -- public final static String CHECKINTERVAL_PROP_NAME = "checkInterval"; // -- Session manager properties -- public final static String SESSIONID_INIT_PROP_NAME = "sessionID"; public final static String MAXACTIVE_SESSIONS_PROP_NAME = "maxActiveSessions"; private ArrayList debugLvlList = null; private ArrayList booleanList = null; // --------------------------------------------------------- Public Methods /** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param actionForm The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception occurs */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(); if (form == null) { getServlet().log(" Creating new ContextForm bean under key " + mapping.getAttribute()); form = new ContextForm(); if ("request".equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form); } String selectedName = request.getParameter("select"); // label of the node that was clicked on. String nodeLabel = request.getParameter("nodeLabel"); ContextForm contextFm = (ContextForm) form; if(debugLvlList == null) { debugLvlList = new ArrayList(); debugLvlList.add(new LabelValueBean("0", "0")); debugLvlList.add(new LabelValueBean("1", "1")); debugLvlList.add(new LabelValueBean("2", "2")); debugLvlList.add(new LabelValueBean("3", "3")); debugLvlList.add(new LabelValueBean("4", "4")); debugLvlList.add(new LabelValueBean("5", "5")); debugLvlList.add(new LabelValueBean("6", "6")); debugLvlList.add(new LabelValueBean("7", "7")); debugLvlList.add(new LabelValueBean("8", "8")); debugLvlList.add(new LabelValueBean("9", "9")); } /* Boolean (true.false) list for cookies */ if(booleanList == null) { booleanList = new ArrayList(); booleanList.add(new LabelValueBean("True", "true")); booleanList.add(new LabelValueBean("False", "false")); } String contextName = null; // context properties Boolean cookies = null; Boolean crossContext = null; Integer debug = null; String docBase = null; Boolean override = null; String path = null; Boolean reloadable = null; Boolean useNaming = null; String workDir = null; // loader properties Integer ldrCheckInterval = null; Integer ldrDebug = null; Boolean ldrReloadable = null; // session properties Integer mgrCheckInterval = null; Integer mgrDebug = null; Integer mgrSessionIDInit = null; Integer mgrMaxSessions = null; try{ if(mBServer == null) { ApplicationServlet servlet = (ApplicationServlet)getServlet(); mBServer = servlet.getServer(); } Iterator contextItr = mBServer.queryMBeans(new ObjectName(selectedName), null).iterator(); ObjectInstance objInstance = (ObjectInstance)contextItr.next(); ObjectName contextObjName = (objInstance).getObjectName(); // Extracting the attribute values for the Context from the MBean cookies = (Boolean) mBServer.getAttribute(contextObjName, COOKIES_PROP_NAME); crossContext = (Boolean) mBServer.getAttribute(contextObjName, CROSS_CONTEXT_PROP_NAME); debug = (Integer) mBServer.getAttribute(contextObjName, DEBUG_PROP_NAME); docBase = (String) mBServer.getAttribute(contextObjName, DOC_BASE_PROP_NAME); override = (Boolean) mBServer.getAttribute(contextObjName, OVERRIDE_PROP_NAME); path = (String) mBServer.getAttribute(contextObjName, PATH_PROP_NAME); reloadable = (Boolean) mBServer.getAttribute(contextObjName, RELOADABLE_PROP_NAME); useNaming = (Boolean) mBServer.getAttribute(contextObjName, USENAMING_PROP_NAME); workDir = (String) mBServer.getAttribute(contextObjName, WORKDIR_PROP_NAME); // Loader properties // FIXME -- will update these to read from the Loader mBean // after code that allows access to this mBean has been checked in. ldrCheckInterval = Integer.valueOf("15"); ldrDebug = Integer.valueOf("0"); ldrReloadable = Boolean.valueOf("true"); // Session manager properties // FIXME -- will update this later, after code that allows access to // SessionManager mBean has been checked in. mgrCheckInterval = Integer.valueOf("60"); mgrDebug = Integer.valueOf("0"); mgrSessionIDInit = Integer.valueOf("0"); mgrMaxSessions = Integer.valueOf("-1"); } catch(Throwable t){ t.printStackTrace(System.out); //forward to error page } //setting values obtained from the mBean to be displayed in the form. contextFm.setNodeLabel(nodeLabel); contextFm.setContextName(selectedName); contextFm.setDebugLvlVals(debugLvlList); contextFm.setBooleanVals(booleanList); // -- Context Properties -- contextFm.setCookies(cookies.toString()); contextFm.setCrossContext(crossContext.toString()); contextFm.setDebugLvl(debug.toString()); contextFm.setDocBase(docBase); contextFm.setOverride(override.toString()); contextFm.setPath(path); contextFm.setReloadable(reloadable.toString()); contextFm.setUseNaming(useNaming.toString()); contextFm.setWorkDir(workDir); // -- Loader properties -- contextFm.setLdrCheckInterval(ldrCheckInterval.toString()); contextFm.setLdrDebugLvl(ldrDebug.toString()); contextFm.setLdrReloadable(ldrReloadable.toString()); // Session manager properties -- contextFm.setMgrCheckInterval(mgrCheckInterval.toString()); contextFm.setMgrDebugLvl(mgrDebug.toString()); contextFm.setMgrSessionIDInit(mgrSessionIDInit.toString()); contextFm.setMgrMaxSessions(mgrMaxSessions.toString()); // Forward back to the test page return (mapping.findForward("Context")); } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>