You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ug...@apache.org on 2004/08/12 23:34:15 UTC

svn commit: rev 36302 - in cocoon/branches/butterfly/src: java/org/apache/butterfly/components/pipeline/impl webapp

Author: ugo
Date: Thu Aug 12 14:34:14 2004
New Revision: 36302

Modified:
   cocoon/branches/butterfly/src/java/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipeline.java
   cocoon/branches/butterfly/src/webapp/sitemap.groovy
Log:
Set mime-type on reader

Modified: cocoon/branches/butterfly/src/java/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipeline.java
==============================================================================
--- cocoon/branches/butterfly/src/java/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipeline.java	(original)
+++ cocoon/branches/butterfly/src/java/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipeline.java	Thu Aug 12 14:34:14 2004
@@ -34,6 +34,8 @@
 import org.apache.butterfly.transformation.Transformer;
 import org.apache.butterfly.xml.XMLConsumer;
 import org.apache.butterfly.xml.XMLProducer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Implementation of the non-caching pipeline.
@@ -43,6 +45,8 @@
  * @version CVS $Id$
  */
 public class NonCachingProcessingPipeline implements ProcessingPipeline {
+
+    protected static final Log logger = LogFactory.getLog(NonCachingProcessingPipeline.class);
     
     /** The generator */
     protected Generator generator;
@@ -166,10 +170,10 @@
         if (null == this.lastConsumer) {
             this.lastConsumer = this.serializer;
         } else {
-            this.preparePipeline(environment);
+            preparePipeline(environment);
         }
         if ( this.reader != null ) {
-            // TODO: implement this.preparePipeline(environment);   
+            preparePipeline(environment);   
             reader.setObjectModel(environment.getObjectModel());
         }
         
@@ -214,7 +218,7 @@
             throw new PipelineProcessingException("Attempted to process incomplete pipeline.");
         }
         if (this.reader != null) {
-            // TODO setupReader(environment);
+            setupReader(environment);
         } else {
             setupPipeline(environment);
         }
@@ -229,6 +233,16 @@
             environment.setContentType("text/xml");
         } else {
             environment.setContentType(this.serializer.getMimeType());
+        }
+    }
+
+    /**
+     * Setup the reader
+     */
+    protected void setupReader(Environment environment) {
+        final String mimeType = this.reader.getMimeType();
+        if (mimeType != null) {
+            environment.setContentType(mimeType);                    
         }
     }
 

Modified: cocoon/branches/butterfly/src/webapp/sitemap.groovy
==============================================================================
--- cocoon/branches/butterfly/src/webapp/sitemap.groovy	(original)
+++ cocoon/branches/butterfly/src/webapp/sitemap.groovy	Thu Aug 12 14:34:14 2004
@@ -33,7 +33,7 @@
             serialize "xml", [ "encoding": "UTF-8", "mimeType": "text/html" ] 
         } else if (m = (uri =~ "images/(.*)\.gif")) {
             read "resource", "resources/images/" + m.group(1) + ".gif", 
-                [ "mimeType": "image/gif" ]
+                [ "mimeType": "image/png" ]
         } else if (m = (uri =~ "styles/(.*)\.css")) {
             read "resource", "resources/styles/" + m.group(1) + ".css",
                 [ "mimeType": "text/css" ]