You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-commits@portals.apache.org by at...@apache.org on 2007/02/23 03:11:21 UTC

svn commit: r510761 - in /portals/bridges/trunk/struts: src/java/org/apache/portals/bridges/struts/config/RenderContextAttributes.java xdocs/features.xml

Author: ate
Date: Thu Feb 22 18:11:20 2007
New Revision: 510761

URL: http://svn.apache.org/viewvc?view=rev&rev=510761
Log:
Fix for PB-41: Tiles Context gets lost "Struts Bridge - error with tiles"
The Tiles ComponentConstants.COMPONENT_CONTEXT attribute is now automatically registered as RenderContextAttribute by the Struts Bridge itself.

Modified:
    portals/bridges/trunk/struts/src/java/org/apache/portals/bridges/struts/config/RenderContextAttributes.java
    portals/bridges/trunk/struts/xdocs/features.xml

Modified: portals/bridges/trunk/struts/src/java/org/apache/portals/bridges/struts/config/RenderContextAttributes.java
URL: http://svn.apache.org/viewvc/portals/bridges/trunk/struts/src/java/org/apache/portals/bridges/struts/config/RenderContextAttributes.java?view=diff&rev=510761&r1=510760&r2=510761
==============================================================================
--- portals/bridges/trunk/struts/src/java/org/apache/portals/bridges/struts/config/RenderContextAttributes.java (original)
+++ portals/bridges/trunk/struts/src/java/org/apache/portals/bridges/struts/config/RenderContextAttributes.java Thu Feb 22 18:11:20 2007
@@ -9,6 +9,7 @@
 import javax.portlet.PortletSession;
 
 import org.apache.commons.digester.Digester;
+import org.apache.struts.taglib.tiles.ComponentConstants;
 
 public class RenderContextAttributes extends AbstractConfigComponent
 {
@@ -144,6 +145,24 @@
     {
         super.afterLoad();
 
+        // special handling for Tiles support, see PB-41
+        boolean found = false;
+        for ( int i = 0, size = namedAttributesList.size(); i < size; i++ )
+        {
+            Attribute attr = (Attribute)namedAttributesList.get(i);
+            if ( ComponentConstants.COMPONENT_CONTEXT.equals(attr.getValue()) )
+            {
+                found = true;
+                break;
+            }
+        }
+        if ( !found )
+        {
+            // Add Tiles COMPONENT_CONTEXT to named Attributes list
+            Attribute tilesContextAttribute = new Attribute();
+            tilesContextAttribute.setName(ComponentConstants.COMPONENT_CONTEXT);
+            namedAttributesList.add(tilesContextAttribute);
+        }
         namedAttributes = createArray(namedAttributesList);
         prefixAttributes = createArray(prefixAttributesList);
         

Modified: portals/bridges/trunk/struts/xdocs/features.xml
URL: http://svn.apache.org/viewvc/portals/bridges/trunk/struts/xdocs/features.xml?view=diff&rev=510761&r1=510760&r2=510761
==============================================================================
--- portals/bridges/trunk/struts/xdocs/features.xml (original)
+++ portals/bridges/trunk/struts/xdocs/features.xml Thu Feb 22 18:11:20 2007
@@ -59,7 +59,7 @@
           </li>
           <li>
             <a href="#PortletRequestProcessor and PortletTilesRequestProcessor">
-              Tiles support and automatic configuration of the correct (Portlet)RequestProcessor 
+              Tiles support and automatic configuration of the correct (Portlet)RequestProcessor (enhanced for 1.0.1)
             </a>
           </li>
           <li>
@@ -414,6 +414,21 @@
         <p>
           Tiles can be used without problem within a Portlet context, even for Action Mapping or ActionForward paths,
           although the same considerations and restrictions must be taken into account as described above.
+        </p>
+        <p>
+          1.0.1: For proper handling of the Tiles Context, with version 1.0 the Tiles ComponentConstants.COMPONENT_CONTEXT had to be
+          set as RenderContextAttribute like this:
+          <source><![CDATA[
+            <?xml version="1.0" encoding="UTF-8"?>
+            <config>
+              <render-context>
+                <attribute name="org.apache.struts.taglib.tiles.CompContext"/>
+                ...
+              </render-context>
+              ...
+            </config>]]></source>
+            With the 1.0.1 release, this isn't necessary anymore as the Struts Bridge will register this special attribute
+            itself automatically if it hasn't been defined in the struts-portlet-config.xml already.
         </p>
       </subsection>      
       <subsection name="Running your application as Portlet and Web Application at the same time">



---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-commits-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-commits-help@portals.apache.org