01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2003-2004 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: CreateConnectorAction.java 7356 2005-09-09 06:42:47Z danesa $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.webapp.jonasadmin.catalina;
25:
26: import java.io.IOException;
27:
28: import javax.servlet.ServletException;
29: import javax.servlet.http.HttpServletRequest;
30: import javax.servlet.http.HttpServletResponse;
31:
32: import org.apache.struts.action.ActionForm;
33: import org.apache.struts.action.ActionForward;
34: import org.apache.struts.action.ActionMapping;
35: import org.objectweb.jonas.webapp.jonasadmin.Jlists;
36:
37: /**
38: * @author Michel-Ange ANTON
39: */
40: public class CreateConnectorAction extends CatalinaBaseAction {
41:
42: // --------------------------------------------------------- Public Methods
43:
44: public ActionForward executeAction(ActionMapping p_Mapping,
45: ActionForm p_Form, HttpServletRequest p_Request,
46: HttpServletResponse p_Response) throws IOException,
47: ServletException {
48:
49: // Get the type of connector to create
50: String sType = p_Request.getParameter("type");
51: if (sType == null) {
52: addGlobalError(new Exception(
53: "The parameter 'type' is null !!!!!"));
54: saveErrors(p_Request, m_Errors);
55: return (p_Mapping.findForward("Global Error"));
56: }
57:
58: // Fill in the form values for display and editing
59: ConnectorForm oForm = new ConnectorForm();
60: m_Session.setAttribute("catalinaConnectorForm", oForm);
61: oForm.reset(p_Mapping, p_Request);
62: oForm.setAction("create");
63: oForm.setBooleanVals(Jlists.getBooleanValues());
64:
65: if ("http".equalsIgnoreCase(sType) == true) {
66: oForm.setConnectorType("HTTP");
67: oForm.setScheme("http");
68: } else if ("https".equalsIgnoreCase(sType) == true) {
69: oForm.setConnectorType("HTTPS");
70: oForm.setScheme("https");
71: } else if ("ajp".equalsIgnoreCase(sType) == true) {
72: oForm.setConnectorType("AJP");
73: oForm.setScheme("http");
74: } else {
75: addGlobalError(new Exception(
76: "The parameter 'type' is unknown"));
77: saveErrors(p_Request, m_Errors);
78: return (p_Mapping.findForward("Global Error"));
79: }
80:
81: // Forward to the connector display page
82: return (p_Mapping.findForward("Catalina Connector"));
83: }
84: }
|