1 16 17 package org.apache.jetspeed.util.servlet; 18 19 import java.io.OutputStream ; 20 import java.io.PrintWriter ; 21 import javax.servlet.RequestDispatcher ; 22 import javax.servlet.ServletContext ; 23 24 import org.apache.turbine.util.RunData; 25 import org.apache.ecs.ConcreteElement; 26 27 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 28 import org.apache.jetspeed.services.logging.JetspeedLogger; 29 30 42 public class EcsServletElement extends ConcreteElement 43 { 44 47 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(EcsServletElement.class.getName()); 48 49 50 private RunData rundata; 51 52 53 private String url; 54 55 62 public EcsServletElement(RunData rundata, String urlString) 63 { 64 this.url = urlString; 65 this.rundata = rundata; 66 } 67 68 73 public void output(OutputStream out) 74 { 75 output(new PrintWriter (out)); 76 } 77 78 83 public void output(PrintWriter out) { 84 ServletContext ctx = rundata.getServletContext(); 85 RequestDispatcher dispatcher = ctx.getRequestDispatcher(url); 86 try 87 { 88 91 dispatcher.include( 93 rundata.getRequest(), 94 rundata.getResponse() ); 95 } 96 catch (Exception e) 97 { 98 String message = "EcsServletElement: Could not include the following URL: " 99 + url + " : " + e.getMessage(); 100 logger.error( message, e ); 101 out.print(message); 102 } 103 } 104 } 105 | Popular Tags |