cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject svn commit: rev 36181 - in cocoon/branches/butterfly/src: java/org/apache/butterfly/serialization java/org/apache/butterfly/servlet java/org/apache/butterfly/sitemap test/org/apache/butterfly/components/pipeline/impl webapp
Date Tue, 10 Aug 2004 17:14:10 GMT
Author: ugo
Date: Tue Aug 10 10:14:08 2004
New Revision: 36181

Modified:
   cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/Serializer.java
   cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/XMLSerializer.java
   cocoon/branches/butterfly/src/java/org/apache/butterfly/servlet/Pipeline.groovy
   cocoon/branches/butterfly/src/java/org/apache/butterfly/sitemap/SitemapOutputComponent.java
   cocoon/branches/butterfly/src/test/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase.java
   cocoon/branches/butterfly/src/webapp/sitemap.groovy
Log:
First stab at parametrizing sitemap components

Modified: cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/Serializer.java
==============================================================================
--- cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/Serializer.java
(original)
+++ cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/Serializer.java
Tue Aug 10 10:14:08 2004
@@ -22,8 +22,12 @@
 /**
  * Description of Serializer.
  * 
- * @version CVS $Id: Serializer.java,v 1.1 2004/07/24 20:21:33 ugo Exp $
+ * @version CVS $Id$
  */
 public interface Serializer extends XMLConsumer, SitemapOutputComponent {
+
+    String getEncoding();
+    
+    void setEncoding(String encoding);
 
 }

Modified: cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/XMLSerializer.java
==============================================================================
--- cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/XMLSerializer.java
(original)
+++ cocoon/branches/butterfly/src/java/org/apache/butterfly/serialization/XMLSerializer.java
Tue Aug 10 10:14:08 2004
@@ -32,7 +32,7 @@
 /**
  * Description of XMLSerializer.
  * 
- * @version CVS $Id: XMLSerializer.java,v 1.2 2004/07/24 20:21:33 ugo Exp $
+ * @version CVS $Id$
  */
 public class XMLSerializer extends AbstractXMLPipe implements Serializer {
 
@@ -131,5 +131,12 @@
      */
     public void setObjectModel(Map objectModel) {
         this.objectModel = objectModel;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.butterfly.sitemap.SitemapOutputComponent#getEncoding()
+     */
+    public String getEncoding() {
+        return (String) format.get(OutputKeys.ENCODING);
     }
 }

Modified: cocoon/branches/butterfly/src/java/org/apache/butterfly/servlet/Pipeline.groovy
==============================================================================
--- cocoon/branches/butterfly/src/java/org/apache/butterfly/servlet/Pipeline.groovy	(original)
+++ cocoon/branches/butterfly/src/java/org/apache/butterfly/servlet/Pipeline.groovy	Tue Aug
10 10:14:08 2004
@@ -37,8 +37,9 @@
         this.pipeline.addTransformer(transformer)
     }
     
-    protected void serialize(type) {
+    protected void serialize(type, parameters) {
         serializer = beanFactory.getBean(type + "Serializer")
+        parameters.each { serializer[it.key] = it.value }
         this.pipeline.serializer = serializer
     }
     

Modified: cocoon/branches/butterfly/src/java/org/apache/butterfly/sitemap/SitemapOutputComponent.java
==============================================================================
--- cocoon/branches/butterfly/src/java/org/apache/butterfly/sitemap/SitemapOutputComponent.java
(original)
+++ cocoon/branches/butterfly/src/java/org/apache/butterfly/sitemap/SitemapOutputComponent.java
Tue Aug 10 10:14:08 2004
@@ -22,7 +22,7 @@
  * This interface marks a component as a sitemap component that produces
  * a response, like a serializer or a reader.
  * 
- * @version CVS $Id: SitemapOutputComponent.java,v 1.1 2004/07/23 08:47:20 ugo Exp $
+ * @version CVS $Id$
  */
 public interface SitemapOutputComponent {
 
@@ -36,7 +36,7 @@
      * Get the mime-type of the output of this <code>Component</code>.
      */
     String getMimeType();
-
+    
     /**
      * Test if the component wants to set the content length
      */

Modified: cocoon/branches/butterfly/src/test/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase.java
==============================================================================
--- cocoon/branches/butterfly/src/test/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase.java
(original)
+++ cocoon/branches/butterfly/src/test/org/apache/butterfly/components/pipeline/impl/NonCachingProcessingPipelineTestCase.java
Tue Aug 10 10:14:08 2004
@@ -136,9 +136,13 @@
                 return false;
             }
             public void setObjectModel(Map objectModel) {}
+            public String getEncoding() {
+                return null;
+            }
+            public void setEncoding(String encoding) {}
         };
         
-        // Set up real compponents
+        // Set up real components
         SourceResolver sourceResolver = new SourceResolver();
         Map sourceFactories = new HashMap();
         sourceFactories.put("*", new FileSourceFactory());

Modified: cocoon/branches/butterfly/src/webapp/sitemap.groovy
==============================================================================
--- cocoon/branches/butterfly/src/webapp/sitemap.groovy	(original)
+++ cocoon/branches/butterfly/src/webapp/sitemap.groovy	Tue Aug 10 10:14:08 2004
@@ -19,12 +19,11 @@
         if (requestPath == "") {
             generate "welcome.xml"
             transform "trax", "welcome.xslt" 
-            serialize "xml"
+            serialize "xml", [ 'encoding': 'UTF-8' ]
         } else if (m = (requestPath =~ "(.*)\.html")) {
-            // TODO: paths should be relative to the webapp context!
             generate m.group(1) + ".xml"
             transform "trax", "welcome.xslt" 
-            serialize "xml"
+            serialize "xml", [ 'encoding': 'UTF-8' ]
         } else if (m = (requestPath =~ "images/(.*)\.gif")) {
             read "resources/images/" + m.group(1) + ".gif", "image/gif"
         } else if (m = (requestPath =~ "styles/(.*)\.css")) {

Mime
View raw message