001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 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: EditServletServerAction.java 6584 2005-04-20 11:58:42Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.jonasserver;
025:
026: import java.io.IOException;
027:
028: import javax.management.ObjectName;
029: import javax.servlet.ServletException;
030: import javax.servlet.http.HttpServletRequest;
031: import javax.servlet.http.HttpServletResponse;
032:
033: import org.apache.struts.action.ActionForm;
034: import org.apache.struts.action.ActionForward;
035: import org.apache.struts.action.ActionMapping;
036: import org.objectweb.jonas.jmx.JonasObjectName;
037: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
038:
039: /**
040: * @author Michel-Ange ANTON
041: */
042:
043: public class EditServletServerAction extends JonasBaseAction {
044:
045: // --------------------------------------------------------- Public Methods
046: /**
047: * Execute action for servlet server management
048: * @param pMapping mapping info
049: * @param pForm form object
050: * @param pRequest HTTP request
051: * @param pResponse HTTP response
052: *
053: * @return An <code>ActionForward</code> instance or <code>null</code>
054: *
055: * @exception IOException if an input/output error occurs
056: * @exception ServletException if a servlet exception occurs
057: */
058: public ActionForward executeAction(ActionMapping pMapping,
059: ActionForm pForm, HttpServletRequest pRequest,
060: HttpServletResponse pResponse) throws IOException,
061: ServletException {
062:
063: // Force the node selected in tree
064: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER),
065: true);
066: // Form used
067: ServletServerForm oForm = new ServletServerForm();
068: pRequest.setAttribute("servletServerForm", oForm);
069: try {
070: // Object name used
071: ObjectName oObjectName = JonasObjectName
072: .webContainerService();
073: oForm.setServerName(getStringAttribute(oObjectName,
074: "ServerName"));
075: oForm.setServerVersion(getStringAttribute(oObjectName,
076: "ServerVersion"));
077: if (m_WhereAreYou.isCatalinaServer()) {
078: oForm.setServerCatalina(true);
079: oForm.setServerCatalinaService(m_WhereAreYou
080: .getCurrentCatalinaServiceName());
081: oForm.setServerCatalinaEngine(m_WhereAreYou
082: .getCurrentCatalinaEngineName());
083: oForm.setServerCatalinaDefaultHost(m_WhereAreYou
084: .getCurrentCatalinaDefaultHostName());
085:
086: // Get the forward parameter in query string or in http request
087: String sForward = pRequest.getParameter("forward");
088: if (sForward == null) {
089: sForward = (String) pRequest
090: .getAttribute("forward");
091: }
092: oForm.setForwardAfter(sForward);
093: }
094: } catch (Throwable t) {
095: addGlobalError(t);
096: saveErrors(pRequest, m_Errors);
097: return (pMapping.findForward("Global Error"));
098: }
099: // Forward to the jsp.
100: return (pMapping.findForward("Servlet Server"));
101: }
102:
103: }
|