cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon EngineWrapper.java cocoon.properties
Date Wed, 01 Dec 1999 11:27:48 GMT
stefano     99/12/01 03:27:48

  Modified:    .        changes.xml
               src/org/apache/cocoon EngineWrapper.java cocoon.properties
  Log:
  Added new producer for processing document sent as request
  payload. Also allowed Cocoon to be called as an external module
  even if this is clearly a dirty hack.
  
  Revision  Changes    Path
  1.3       +5 -1      xml-cocoon/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/changes.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- changes.xml	1999/11/30 16:29:50	1.2
  +++ changes.xml	1999/12/01 11:27:47	1.3
  @@ -4,7 +4,7 @@
   
   <!-- 
     History of Cocoon changes
  -  $Id: changes.xml,v 1.2 1999/11/30 16:29:50 stefano Exp $
  +  $Id: changes.xml,v 1.3 1999/12/01 11:27:47 stefano Exp $
   -->
   
   <changes title="Cocoon History of Changes">
  @@ -16,6 +16,10 @@
     </devs>
   
    <release version="1.6-dev" date="">
  +  <action dev="SM" type="add" due-to="Gerrit Hiddink" due-to-email="grit@wwcn.org">
  +    Add new producer for POST document processing, also useful for use of 
  +    Cocoon as a module (see EngineWrapper).
  +  </action>
     <action dev="SM" type="fix" due-to="Ambarish Chaudhari" due-to-email="ambarish.chaudhari@ecapsol.com">
       Fixed null problem in MemoryStore for command line operation.
     </action>
  
  
  
  1.4       +44 -11    xml-cocoon/src/org/apache/cocoon/EngineWrapper.java
  
  Index: EngineWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/EngineWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EngineWrapper.java	1999/11/09 02:29:14	1.3
  +++ EngineWrapper.java	1999/12/01 11:27:48	1.4
  @@ -1,4 +1,4 @@
  -/*-- $Id: EngineWrapper.java,v 1.3 1999/11/09 02:29:14 dirkx Exp $ -- 
  +/*-- $Id: EngineWrapper.java,v 1.4 1999/12/01 11:27:48 stefano Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -61,20 +61,32 @@
    * This class implements wrapping methods that allow the engine to be
    * called even from other APIs or standalone applications.
    *
  + * NOTE: this is a dirty hack and I know it. The problem is that Cocoon is
  + * a servlet and the servlet API are not that easy to deal with when you
  + * enter other modes of operation (like command line or RMI).
  + * 
  + * We will need to clean this up and remove the need of direct 
  + * HttpServletRequest/Response emulation when we integrate with Stylebook.
  + * But I have more important stuff to do right now.
  + *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.3 $ $Date: 1999/11/09 02:29:14 $
  + * @version $Revision: 1.4 $ $Date: 1999/12/01 11:27:48 $
    */
   
   public class EngineWrapper extends Engine {
  -    
  +
       public EngineWrapper(Configurations confs) throws Exception {
           super(confs);
       }
  +
  +    public void handle(PrintWriter out, File pathToDocument) throws Exception {
  +        this.handle(new HttpServletRequestImpl(pathToDocument), new HttpServletResponseImpl(out));
  +    }
   
  -    public void handle(PrintWriter out, String document) throws Exception {
  -        this.handle(new HttpServletRequestImpl(document), new HttpServletResponseImpl(out));
  +    public void handle(PrintWriter out, File documentPath, String document) throws Exception
{
  +        this.handle(new HttpServletRequestImpl(documentPath, document), new HttpServletResponseImpl(out));
       }
  -    
  +
       /**
        * Dummy implementation of the HttpServletRequest class to create a 
        * fake but funtional request for the main engine.
  @@ -82,12 +94,23 @@
        */
       public class HttpServletRequestImpl implements HttpServletRequest {
           
  -        private String pathTranslated;
  +        private String pathTranslated = "/";
  +        private String document = null;
           
  -        public HttpServletRequestImpl(String pathTranslated) {
  -            this.pathTranslated = pathTranslated;
  +        public HttpServletRequestImpl(File path) {
  +            this(path, null);
           }
   
  +        public HttpServletRequestImpl(File pathTranslated, String document) {
  +            if (path != null) {
  +                this.pathTranslated = pathTranslated.toString();
  +            }
  +            
  +            if (document != null) {
  +                this.document = document;
  +            }
  +        }
  +
           public String getPathTranslated() {
               return this.pathTranslated;
           }
  @@ -95,8 +118,19 @@
           // FIXME: this is a quick hack to make command line operation work
           // with FileProducer. Check this when Servlet 2.2 are in place.
           public String getPathInfo() { return ""; }
  +
  +        public String getParameter(String name) { 
  +            if ((data != null) &&  (name.equalsIgnoreCase("producer"))) {
  +                return "org.apache.cocoon.producer.ProducerFromRequest";
  +            } else {
  +                return null;
  +            }
  +        }
   
  -        public String getParameter(String name) { return null; }
  +        public BufferedReader getReader () throws IOException { 
  +            return (document == null) ? null : new BufferedReader(new StringReader(document));

  +        }
  +        
           public Enumeration getParameterNames() { return null; }
           public String[] getParameterValues(String name) { return null; }
           public int getContentLength() { return -1; }
  @@ -109,7 +143,6 @@
           public String getRemoteHost() { return null; }
           public ServletInputStream getInputStream() throws IOException { return null; }
           public Object getAttribute(String name) { return null; }
  -        public BufferedReader getReader () throws IOException { return null; }
           public String getCharacterEncoding () { return null; }
           public Cookie[] getCookies() { return null; }
           public String getMethod() { return null; }
  
  
  
  1.3       +3 -1      xml-cocoon/src/org/apache/cocoon/cocoon.properties
  
  Index: cocoon.properties
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/cocoon.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- cocoon.properties	1999/11/30 16:30:03	1.2
  +++ cocoon.properties	1999/12/01 11:27:48	1.3
  @@ -40,7 +40,9 @@
   # The syntax for this is
   #   producer.type.xxx = full.class.name
   # where "xxx" is the producer indentier used in the request
  -producer.type.file = org.apache.cocoon.producer.FileProducer
  +producer.type.file = org.apache.cocoon.producer.ProducerFromFile
  +producer.type.request = org.apache.cocoon.producer.ProducerFromRequest
  +
   producer.type.dummy = org.apache.cocoon.example.DummyProducer
   
   # When producer indication is present in the request
  
  
  

Mime
View raw message