Return-Path: Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 90560 invoked from network); 18 Sep 2000 15:43:57 -0000 Received: from frankfurt.denic.de (HELO notes.denic.de) (194.246.96.101) by locus.apache.org with SMTP; 18 Sep 2000 15:43:57 -0000 Received: from denic.de ([192.168.0.187]) by notes.denic.de (Lotus Domino Version 5.0.2c (Intl)) with ESMTP id 2000091817424266:313 ; Mon, 18 Sep 2000 17:42:42 +0200 Sender: ulim Message-ID: <39C63984.FB6D39F2@denic.de> Date: Mon, 18 Sep 2000 17:49:24 +0200 From: Ulrich Mayring Organization: DENIC eG X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.12-32 i686) X-Accept-Language: en MIME-Version: 1.0 To: cocoon-users@xml.apache.org Subject: Re: How to Call Servlets, CGIs on your server and other servers;ServletChaining References: X-MIMETrack: Itemize by SMTP Server on notes/Denic(Version 5.0.2c (Intl)|08 Februar 2000) at 18.09.2000 17:42:42, Serialize by Router on notes/Denic(Version 5.0.2c (Intl)|08 Februar 2000) at 18.09.2000 17:43:10, Serialize complete at 18.09.2000 17:43:10 Content-Type: multipart/mixed; boundary="------------9CCF35D121772E1D43563907" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N --------------9CCF35D121772E1D43563907 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Per Kreipke wrote: > > Uli, > > Can you share this code with the rest of us? Sure, find it in the attachment. You'll also need ProducerFromRequest.java and CocoonServletRequest.java from the standard cocoon distribution. And make sure no-one unauthorized can access this servlet. Ulrich -- Ulrich Mayring DENIC eG, Systementwicklung --------------9CCF35D121772E1D43563907 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; name="CocoonInterface.java" Content-Disposition: inline; filename="CocoonInterface.java" /* * cocooninterface.java * * Created on 22. August 2000, 17:08 */ package de.denic.servlet; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.cocoon.Engine; import org.apache.cocoon.util.CocoonServletRequest; public class CocoonInterface extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { PrintWriter out = res.getWriter(); res.setContentType("text/html"); // Read XML document from request String document = ""; String line = null; BufferedReader in = new BufferedReader(new InputStreamReader(req.getInputStream())); while ((line = in.readLine()) != null) { document += (line + "\n"); } in.close(); try { // Get the Cocoon Engine Engine cocoonEngine = Engine.getInstance(); // Wrap my request object and add the String document to it CocoonServletRequest myReq = new CocoonServletRequest(document, req); // Specify some additional parmaters // myReq.addParameter("foo", "bar"); // myReq.addParameter("apache", "xml"); // Pass in the real response object. If I wanted to // filter the output further, I could easily construct // a CocoonServletResponse object and pass that in, // and pull the output out of it. cocoonEngine.handle(myReq, res); } catch (Exception e) { out.println("Error: " + e.getMessage()); } out.close(); } } --------------9CCF35D121772E1D43563907--