01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.console.apache.jk;
17:
18: import java.io.IOException;
19:
20: import org.apache.geronimo.console.MultiPageAbstractHandler;
21: import org.apache.geronimo.console.MultiPagePortlet;
22: import org.apache.geronimo.console.apache.jk.BaseApacheHandler.ApacheModel;
23:
24: import javax.portlet.PortletConfig;
25: import javax.portlet.PortletException;
26: import javax.portlet.PortletRequest;
27: import javax.portlet.RenderRequest;
28: import javax.portlet.RenderResponse;
29: import javax.portlet.WindowState;
30:
31: /**
32: * Portlet that helps you configure Geronimo for Apache 2 with mod_jk
33: *
34: * @version $Rev: 563537 $ $Date: 2007-08-07 08:59:31 -0700 (Tue, 07 Aug 2007) $
35: */
36: public class ApacheConfigPortlet extends MultiPagePortlet {
37: public void init(PortletConfig config) throws PortletException {
38: super .init(config);
39: addHelper(new IndexHandler(), config);
40: addHelper(new ConfigHandler(), config);
41: addHelper(new AJPHandler(), config);
42: addHelper(new WebAppHandler(), config);
43: addHelper(new ResultsHandler(), config);
44: }
45:
46: public void doView(RenderRequest renderRequest,
47: RenderResponse renderResponse) throws IOException,
48: PortletException {
49: if (WindowState.MINIMIZED
50: .equals(renderRequest.getWindowState())) {
51: return;
52: }
53: String mode = renderRequest.getParameter(MODE_KEY);
54: ApacheModel model = (ApacheModel) getModel(renderRequest);
55: if (mode == null || mode.equals("")) {
56: mode = getDefaultMode();
57: }
58: MultiPageAbstractHandler handler = (MultiPageAbstractHandler) helpers
59: .get(mode);
60: try {
61: if (handler != null) {
62: handler
63: .renderView(renderRequest, renderResponse,
64: model);
65: }
66: } catch (Throwable e) {
67:
68: }
69: // decode the paths in model object
70: model.setLogFilePath(model.getLogFilePath());
71: model.setWorkersPath(model.getWorkersPath());
72: renderRequest.setAttribute(getModelJSPVariableName(), model);
73: if (handler != null) {
74: handler.getView().include(renderRequest, renderResponse);
75: }
76: }
77:
78: protected String getModelJSPVariableName() {
79: return "model";
80: }
81:
82: protected ApacheModel getModel(PortletRequest request) {
83: return new BaseApacheHandler.ApacheModel(request);
84: }
85: }
|