cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r487319 - in /cocoon/trunk/blocks: cocoon-portal/cocoon-portal-portlet-impl/ cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/ cocoon-portal/cocoon-portal-sample/ cocoon-portal/cocoon-portal-samp...
Date Thu, 14 Dec 2006 19:46:14 GMT
Author: cziegeler
Date: Thu Dec 14 11:46:13 2006
New Revision: 487319

URL: http://svn.apache.org/viewvc?view=rev&rev=487319
Log:
Use general including mechanism

Removed:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sitemap/src/main/java/org/apache/cocoon/portal/serialization/
    cocoon/trunk/blocks/cocoon-serializers/cocoon-serializers-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-serializers.xconf
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/pom.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/pom.xml
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
    cocoon/trunk/blocks/cocoon-serializers/cocoon-serializers-impl/src/main/java/org/apache/cocoon/components/serializers/EncodingSerializer.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/pom.xml?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/pom.xml Thu Dec 14 11:46:13
2006
@@ -51,6 +51,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-serializers-impl</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-portal-sitemap</artifactId>
       <version>1.0.0-SNAPSHOT</version>
     </dependency>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java
Thu Dec 14 11:46:13 2006
@@ -31,6 +31,8 @@
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.components.serializers.EncodingSerializer;
+import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.http.HttpEnvironment;
 import org.apache.cocoon.portal.Constants;
 import org.apache.cocoon.portal.PortalException;
@@ -50,12 +52,10 @@
 import org.apache.cocoon.portal.pluto.om.common.ObjectIDImpl;
 import org.apache.cocoon.portal.pluto.servlet.ServletRequestImpl;
 import org.apache.cocoon.portal.pluto.servlet.ServletResponseImpl;
-import org.apache.cocoon.portal.serialization.IncludingHTMLSerializer;
 import org.apache.cocoon.portal.services.aspects.PortalManagerAspect;
 import org.apache.cocoon.portal.services.aspects.PortalManagerAspectPrepareContext;
 import org.apache.cocoon.portal.services.aspects.PortalManagerAspectRenderContext;
 import org.apache.cocoon.portal.util.HtmlSaxParser;
-import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
 import org.apache.pluto.PortletContainerImpl;
@@ -191,22 +191,15 @@
 
             // TODO - for parallel processing we have to clone the response!
             this.portletContainer.renderPortlet(window, req.getRequest(window), res);
-            final String value = this.getResponse(coplet, res);
+            final String content = this.getResponse(coplet, res);
 
             final Boolean usePipeline = (Boolean)this.getConfiguration(coplet, "use-pipeline",
Boolean.FALSE);
             if ( usePipeline.booleanValue() ) {
-                HtmlSaxParser.parseString(value, HtmlSaxParser.getContentFilter(contentHandler));
+                HtmlSaxParser.parseString(content, HtmlSaxParser.getContentFilter(contentHandler));
             } else {
                 // stream out the include for the serializer
-                IncludingHTMLSerializer.addPortlet(coplet.getId(), value);
-                contentHandler.startPrefixMapping("portal", IncludingHTMLSerializer.NAMESPACE);
-                final AttributesImpl attr = new AttributesImpl();
-                attr.addCDATAAttribute("portlet", coplet.getId());
-                contentHandler.startElement(IncludingHTMLSerializer.NAMESPACE, 
-                                            "include", "portal:include", attr);
-                contentHandler.endElement(IncludingHTMLSerializer.NAMESPACE, 
-                                          "include", "portal:include");
-                contentHandler.endPrefixMapping("portal");
+                final org.apache.cocoon.environment.Request request = ObjectModelHelper.getRequest(this.portalService.getProcessInfoProvider().getObjectModel());
+                EncodingSerializer.include(content, request, contentHandler);
             }
         } catch (SAXException se) {
             throw se;

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml Thu Dec 14 11:46:13 2006
@@ -88,5 +88,10 @@
       <artifactId>cocoon-portal-portlet-impl</artifactId>
       <version>1.0.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-serializers-impl</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
   </dependencies>
 </project>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
Thu Dec 14 11:46:13 2006
@@ -36,16 +36,17 @@
       <map:transformer name="portal-html-eventlink" src="org.apache.cocoon.portal.transformation.HTMLEventLinkTransformer"/>
       <map:transformer name="portal-html-linktoeventlink" src="org.apache.cocoon.portal.transformation.LinkTransformer"/>
     </map:transformers>
-    <map:readers default="resource">
-      <map:reader name="portal-proxy" src="org.apache.cocoon.portal.reading.ProxyReader"/>
-    </map:readers>
     <map:serializers default="html">
-      <map:serializer name="html-include" mime-type="text/html" pool-max="32"
-                      src="org.apache.cocoon.portal.serialization.IncludingHTMLSerializer">
-        <doctype-public>-//W3C//DTD HTML 4.01 Transitional//EN</doctype-public>
-        <doctype-system>http://www.w3.org/TR/html4/loose.dtd</doctype-system>
+      <map:serializer name="ehtml"
+                      logger="sitemap.serializer.ehtml"
+                      src="org.apache.cocoon.components.serializers.HTMLSerializer"
+                      mime-type="text/html">
+        <encoding>UTF-8</encoding>
       </map:serializer>
     </map:serializers>
+    <map:readers default="resource">
+      <map:reader name="portal-proxy" src="org.apache.cocoon.portal.reading.ProxyReader"/>
+    </map:readers>
     <map:selectors>
       <map:selector name="ajax-request" src="org.apache.cocoon.ajax.AjaxRequestSelector"/>
     </map:selectors>
@@ -225,9 +226,7 @@
               <map:transform type="portal-coplet"/>
               <map:transform type="portal-new-eventlink"/>
               <map:transform type="encodeURL"/>
-              <!-- If you don't need JSR-168 support,
-                   you can use the html serializer instead -->
-              <map:serialize type="html-include"/>
+              <map:serialize type="ehtml"/>
             </map:otherwise>
           </map:select>
         </map:act>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/pom.xml?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/pom.xml Thu Dec 14 11:46:13
2006
@@ -45,6 +45,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-serializers-impl</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-portal-sitemap</artifactId>
       <version>1.0.0-SNAPSHOT</version>
     </dependency>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-wsrp-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
Thu Dec 14 11:46:13 2006
@@ -45,6 +45,8 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.components.serializers.EncodingSerializer;
+import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.wrapper.RequestParameters;
 import org.apache.cocoon.portal.coplet.adapter.CopletDecorationProvider;
 import org.apache.cocoon.portal.coplet.adapter.DecorationAction;
@@ -56,7 +58,6 @@
 import org.apache.cocoon.portal.om.CopletInstance;
 import org.apache.cocoon.portal.om.Layout;
 import org.apache.cocoon.portal.om.LayoutFeatures;
-import org.apache.cocoon.portal.serialization.IncludingHTMLSerializer;
 import org.apache.cocoon.portal.util.HtmlSaxParser;
 import org.apache.cocoon.portal.wsrp.consumer.ConsumerEnvironmentImpl;
 import org.apache.cocoon.portal.wsrp.consumer.ProducerDescription;
@@ -366,18 +367,8 @@
                 HtmlSaxParser.parseString(content, HtmlSaxParser.getContentFilter(handler));
             } else {
                 // stream out the include for the serializer
-                IncludingHTMLSerializer.addPortlet(portletInstanceKey, content);
-                contentHandler.startPrefixMapping("portal", IncludingHTMLSerializer.NAMESPACE);
-                final AttributesImpl attr = new AttributesImpl();
-                attr.addCDATAAttribute("portlet", portletInstanceKey);
-                contentHandler.startElement(IncludingHTMLSerializer.NAMESPACE,
-                                            "include",
-                                            "portal:include",
-                                            attr);
-                contentHandler.endElement(IncludingHTMLSerializer.NAMESPACE,
-                                          "include",
-                                          "portal:include");
-                contentHandler.endPrefixMapping("portal");
+                final org.apache.cocoon.environment.Request request = ObjectModelHelper.getRequest(this.portalService.getProcessInfoProvider().getObjectModel());
+                EncodingSerializer.include(content, request, contentHandler);
             }
         } catch (WSRPException e) {
             throw new SAXException("Exception during getMarkup of wsrp coplet: " + coplet.getId(),
e);

Modified: cocoon/trunk/blocks/cocoon-serializers/cocoon-serializers-impl/src/main/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-serializers/cocoon-serializers-impl/src/main/java/org/apache/cocoon/components/serializers/EncodingSerializer.java?view=diff&rev=487319&r1=487318&r2=487319
==============================================================================
--- cocoon/trunk/blocks/cocoon-serializers/cocoon-serializers-impl/src/main/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
(original)
+++ cocoon/trunk/blocks/cocoon-serializers/cocoon-serializers-impl/src/main/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
Thu Dec 14 11:46:13 2006
@@ -20,7 +20,9 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.avalon.excalibur.pool.Recyclable;
@@ -38,8 +40,10 @@
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.serialization.Serializer;
 import org.apache.cocoon.sitemap.SitemapModelComponent;
+import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.commons.lang.SystemUtils;
 import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 
@@ -126,7 +130,7 @@
 
     protected Request request;
 
-    public static final String CONTENT_MAP_ATTRIBUTE = EncodingSerializer.class.getName()
+ "/ContentMap";
+    protected static final String CONTENT_LIST_ATTRIBUTE = EncodingSerializer.class.getName()
+ "/ContentList";
 
     public static final String NAMESPACE = "http://apache.org/cocoon/serializers/include";
 
@@ -153,6 +157,30 @@
     }
 
     /**
+     * Add the content to the output without sending it through the pipeline.
+     * @param content
+     * @param request
+     * @param handler
+     */
+    public static void include(String content, Request request, ContentHandler handler)
+    throws SAXException {
+        if ( content != null ) {
+            List values = (List)request.getAttribute(CONTENT_LIST_ATTRIBUTE);
+            if ( values == null ) {
+                values = new ArrayList();
+            }
+            values.add(content);
+            request.setAttribute(CONTENT_LIST_ATTRIBUTE, values);
+            handler.startPrefixMapping("encser", NAMESPACE);
+            final AttributesImpl attr = new AttributesImpl();
+            attr.addCDATAAttribute("index", String.valueOf(values.size() - 1));
+            handler.startElement(NAMESPACE, "include", "encser:include", attr);
+            handler.endElement(NAMESPACE, "include", "encser:include");
+            handler.endPrefixMapping("encser");
+        }
+    }
+
+    /**
      * Test if the component wants to set the content length.
      */
     public boolean shouldSetContentLength() {
@@ -476,12 +504,13 @@
                                    Attributes attributes)
     throws SAXException {
         if (NAMESPACE.equals(nsuri)) {
-            final String contentId = attributes.getValue("portlet");
+            final String contentId = attributes.getValue("index");
+            final int index = Integer.valueOf(contentId).intValue();
 
             String value = null;
-            final Map map = (Map)this.request.getAttribute(CONTENT_MAP_ATTRIBUTE);
-            if ( map != null ) {
-                value = (String)map.get(contentId);
+            final List values = (List)this.request.getAttribute(CONTENT_LIST_ATTRIBUTE);
+            if ( values != null ) {
+                value = (String)values.get(index);
             }
             if ( value != null ) {
                 this.write(value);



Mime
View raw message