Revision: 1291
          http://stripes.svn.sourceforge.net/stripes/?rev=1291&view=rev
Author:   bengunter
Date:     2010-09-29 16:26:36 +0000 (Wed, 29 Sep 2010)

Log Message:
-----------
STS-391: Do not cache the layout ancestor. It doesn't save much in terms of 
performance, and it would have to be cleared by subclasses due to tag pooling.

Modified Paths:
--------------
    branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java    
    2010-09-29 16:23:29 UTC (rev 1290)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java    
    2010-09-29 16:26:36 UTC (rev 1291)
@@ -17,7 +17,6 @@
 import java.util.Map.Entry;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.jsp.tagext.Tag;
 
 import net.sourceforge.stripes.controller.StripesConstants;
 import net.sourceforge.stripes.tag.StripesTagSupport;
@@ -30,8 +29,6 @@
  * @since Stripes 1.5.4
  */
 public abstract class LayoutTag extends StripesTagSupport {
-    private LayoutTag layoutAncestor;
-
     /** Get the context-relative path of the page that invoked this tag. */
     public String getCurrentPagePath() {
         HttpServletRequest request = (HttpServletRequest) 
pageContext.getRequest();
@@ -66,21 +63,12 @@
     }
 
     /**
-     * Get the nearest ancestor of this tag that is an instance of either
-     * {...@link LayoutDefinitionTag} or {...@link LayoutRenderTag}. If no 
ancestor of either type is
-     * found then null.
+     * Get the nearest ancestor of this tag that is an instance of {...@link 
LayoutTag}. If no ancestor
+     * of that type is found then null.
      */
     @SuppressWarnings("unchecked")
     public <T extends LayoutTag> T getLayoutAncestor() {
-        if (layoutAncestor == null) {
-            for (Tag tag = getParent(); tag != null; tag = tag.getParent()) {
-                if (tag instanceof LayoutTag) {
-                    return (T) (this.layoutAncestor = (LayoutTag) tag);
-                }
-            }
-        }
-
-        return (T) layoutAncestor;
+        return (T) getParentTag(LayoutTag.class);
     }
 
     /**


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to