1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */161718packageorg.apache.jetspeed.portal.portlets;
1920import org.apache.ecs.ConcreteElement;
21import org.apache.ecs.StringElement;
2223import org.apache.jetspeed.portal.PortletConfig;
24import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
25import org.apache.jetspeed.services.logging.JetspeedLogger;
26import org.apache.jetspeed.portal.portlets.AbstractPortlet;
27import org.apache.jetspeed.util.servlet.EcsServletElement;
2829import org.apache.turbine.util.RunData;
3031/***32 * The ServletInvokerPortlet invokes a servlet or JSP and displays the result.33 * 34 * @author Thomas Schaeck (schaeck@de.ibm.com)35 */36publicclassServletInvokerPortletextendsAbstractPortlet37 {
3839/***40 * Static initialization of the logger for this class41 */42privatestaticfinalJetspeedLogger logger = JetspeedLogFactoryService.getLogger(ServletInvokerPortlet.class.getName());
4344/***45 * Returns an ECS concrete element that includes the servlet/JSP.46 *47 * The servlet/JSP will be invoked when the ECS tree is written 48 * to the servlet output stream and add its output to the stream.49 */50public ConcreteElement getContent(RunData rundata) {
51// !!! Need to check this - is this the right rundata object ? !!!52 PortletConfig pc = this.getPortletConfig();
5354 String servletURL = null;
55try {
56 servletURL = (String) this.getPortletConfig().getInitParameter("url");
57returnnew EcsServletElement(rundata, servletURL);
58 } catch (Exception e) {
59 String message = "ServletInvokerPortlet: Error invoking "60 + servletURL + ": " + e.getMessage();
61 logger.error(message, e);
62returnnew StringElement(message);
63 }
64 } }