cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r158423 - in cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon: jxpath/ taglib/ taglib/core/ taglib/string/
Date Mon, 21 Mar 2005 09:15:24 GMT
Author: cziegeler
Date: Mon Mar 21 01:15:22 2005
New Revision: 158423

URL: http://svn.apache.org/viewcvs?view=rev&rev=158423
Log:
Possible fix for the lookup problem

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/jxpath/JXPathCocoonContexts.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/BodyContent.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TagSupport.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTag.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTagSupport.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTagSupport.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTransformerTagSupport.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTag.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTagSupport.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTag.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagSupport.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/LowerCaseTag.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/UpperCaseTag.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/jxpath/JXPathCocoonContexts.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/jxpath/JXPathCocoonContexts.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/jxpath/JXPathCocoonContexts.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/jxpath/JXPathCocoonContexts.java
Mon Mar 21 01:15:22 2005
@@ -17,10 +17,10 @@
 
 import java.util.Map;
 
-import org.apache.avalon.excalibur.pool.Recyclable;
 import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
@@ -64,12 +64,13 @@
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * @version CVS $Id$
  */
-public final class JXPathCocoonContexts implements Component, Contextualizable, Recyclable
{
+public final class JXPathCocoonContexts implements Component, Contextualizable, ThreadSafe
{
 
     public static final String ROLE = JXPathCocoonContexts.class.getName();
 
+    private static final String VARCONTEXT = Constants.JXPATH_CONTEXT + "/VAR";
+
     private static JXPathContextFactory factory;
-    private JXPathContext variableContext;
     private Context context;
 
     static {
@@ -84,10 +85,15 @@
     }
 
     public final JXPathContext getVariableContext() {
-        if (variableContext == null) {
-            variableContext = factory.newContext(getRequestContext(), null);
+        final Map objectModel = ContextHelper.getObjectModel(this.context);
+
+        Request request = ObjectModelHelper.getRequest(objectModel);
+        JXPathContext context = (JXPathContext) request.getAttribute(VARCONTEXT);
+        if (context == null) {
+            context = factory.newContext(getRequestContext(), null);
+            request.setAttribute(VARCONTEXT, context);
         }
-        return variableContext;
+        return context;
     }
 
     /**
@@ -157,10 +163,4 @@
         return context;
     }
 
-    /*
-     * @see Recyclable#recycle()
-     */
-    public void recycle() {
-        this.variableContext = null;
-    }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/BodyContent.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/BodyContent.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/BodyContent.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/BodyContent.java
Mon Mar 21 01:15:22 2005
@@ -24,12 +24,10 @@
 public class BodyContent {
 
     private SaxBuffer content;
-    private XMLConsumer consumer;
 
 
     public BodyContent(SaxBuffer content, XMLConsumer consumer) {
         this.content = content;
-        this.consumer = consumer;
     }
 
     public void clearBody() {

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TagSupport.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TagSupport.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TagSupport.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TagSupport.java
Mon Mar 21 01:15:22 2005
@@ -69,10 +69,10 @@
                 return null;
             }
 
-            if ((isInterface && klass.isInstance(tag)) || klass.isAssignableFrom(tag.getClass()))
+            if ((isInterface && klass.isInstance(tag)) || klass.isAssignableFrom(tag.getClass()))
{
                 return tag;
-            else
-                from = tag;
+            }
+            from = tag;
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTag.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTag.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTag.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTag.java
Mon Mar 21 01:15:22 2005
@@ -20,8 +20,9 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: TransformerTag.java,v 1.3 2004/03/05 13:02:24 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public interface TransformerTag extends XMLConsumer, XMLProducerTag {
 
+    // just a combination of the two interfaces
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTagSupport.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTagSupport.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTagSupport.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/TransformerTagSupport.java
Mon Mar 21 01:15:22 2005
@@ -23,7 +23,7 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: TransformerTagSupport.java,v 1.3 2004/03/05 13:02:24 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public class TransformerTagSupport extends TagSupport implements TransformerTag {
     protected XMLConsumer xmlConsumer;
@@ -39,12 +39,14 @@
      * @see ContentHandler#startDocument()
      */
     public void startDocument() throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#endDocument()
      */
     public void endDocument() throws SAXException {
+        // nothing to do here
     }
 
     /*

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTagSupport.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTagSupport.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTagSupport.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTagSupport.java
Mon Mar 21 01:15:22 2005
@@ -29,7 +29,7 @@
  * Add support for setting and getting variables
  * 
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: VarTagSupport.java,v 1.6 2004/03/05 13:02:24 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public abstract class VarTagSupport extends TagSupport implements Serviceable {
     protected String var;
@@ -59,10 +59,10 @@
 
     protected final Object getVariable(String name) {
         JXPathContext context = getVariableContext();
-        if (name.charAt(0) == '$')
+        if (name.charAt(0) == '$') {
             return context.getValue(name);
-        else
-            return context.getVariables().getVariable(name);
+        }
+        return context.getVariables().getVariable(name);
         //getRequest().getAttribute(name);
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTransformerTagSupport.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTransformerTagSupport.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTransformerTagSupport.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/VarTransformerTagSupport.java
Mon Mar 21 01:15:22 2005
@@ -23,7 +23,7 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: VarTransformerTagSupport.java,v 1.3 2004/03/05 13:02:24 bdelacretaz
Exp $
+ * @version CVS $Id$
  */
 public class VarTransformerTagSupport extends VarTagSupport implements TransformerTag {
     protected XMLConsumer xmlConsumer;
@@ -39,12 +39,14 @@
      * @see ContentHandler#startDocument()
      */
     public void startDocument() throws SAXException {
+        // nothing to do here        
     }
 
     /*
      * @see ContentHandler#endDocument()
      */
     public void endDocument() throws SAXException {
+        // nothing to do here
     }
 
     /*

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTag.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTag.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTag.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTag.java
Mon Mar 21 01:15:22 2005
@@ -20,8 +20,9 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: XMLConsumerTag.java,v 1.3 2004/03/05 13:02:24 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public interface XMLConsumerTag extends Tag, XMLConsumer {
 
+    // just a combination of the two interfaces
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTagSupport.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTagSupport.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTagSupport.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLConsumerTagSupport.java
Mon Mar 21 01:15:22 2005
@@ -21,7 +21,7 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: XMLConsumerTagSupport.java,v 1.3 2004/03/05 13:02:24 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public abstract class XMLConsumerTagSupport extends VarTagSupport implements XMLConsumerTag
{
 
@@ -29,108 +29,126 @@
      * @see ContentHandler#characters(char[], int, int)
      */
     public void characters(char[] ch, int start, int length) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#endDocument()
      */
     public void endDocument() throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#endElement(String, String, String)
      */
     public void endElement(String namespaceURI, String localName, String qName) throws SAXException
{
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#endPrefixMapping(String)
      */
     public void endPrefixMapping(String prefix) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#ignorableWhitespace(char[], int, int)
      */
     public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
{
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#processingInstruction(String, String)
      */
     public void processingInstruction(String target, String data) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#setDocumentLocator(Locator)
      */
     public void setDocumentLocator(Locator locator) {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#skippedEntity(String)
      */
     public void skippedEntity(String name) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#startDocument()
      */
     public void startDocument() throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#startElement(String, String, String, Attributes)
      */
     public void startElement(String namespaceURI, String localName, String qName, Attributes
atts) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see ContentHandler#startPrefixMapping(String, String)
      */
     public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see LexicalHandler#comment(char[], int, int)
      */
     public void comment(char[] ch, int start, int length) throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see LexicalHandler#endCDATA()
      */
     public void endCDATA() throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see LexicalHandler#endDTD()
      */
     public void endDTD() throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see LexicalHandler#endEntity(String)
      */
     public void endEntity(String name) throws SAXException {
-    }
+        // nothing to do here
+   }
 
     /*
      * @see LexicalHandler#startCDATA()
      */
     public void startCDATA() throws SAXException {
+        // nothing to do here
     }
 
     /*
      * @see LexicalHandler#startDTD(String, String, String)
      */
     public void startDTD(String name, String publicId, String systemId) throws SAXException
{
+        // nothing to do here
     }
 
     /*
      * @see LexicalHandler#startEntity(String)
      */
     public void startEntity(String name) throws SAXException {
-    }
+        // nothing to do here
+   }
 
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTag.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTag.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTag.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/XMLProducerTag.java
Mon Mar 21 01:15:22 2005
@@ -20,8 +20,10 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: XMLProducerTag.java,v 1.3 2004/03/05 13:02:24 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public interface XMLProducerTag extends Tag, XMLProducer {
+
+    // just a combination of the two interfaces
 
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagSupport.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagSupport.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagSupport.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/core/LoopTagSupport.java
Mon Mar 21 01:15:22 2005
@@ -63,7 +63,7 @@
  * @see javax.servlet.jsp.jstl.core.LoopTagSupport
  *
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: LoopTagSupport.java,v 1.5 2004/03/05 13:02:24 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public abstract class LoopTagSupport extends VarTagSupport implements LoopTag, IterationTag
//, TryCatchFinally
 {
@@ -351,22 +351,22 @@
                 return (last); // use cached value
             }
             public Integer getBegin() {
-                if (beginSpecified)
+                if (beginSpecified) {
                     return (new Integer(begin));
-                else
-                    return null;
+                }
+                return null;
             }
             public Integer getEnd() {
-                if (endSpecified)
+                if (endSpecified) {
                     return (new Integer(end));
-                else
-                    return null;
+                }
+                return null;
             }
             public Integer getStep() {
-                if (stepSpecified)
+                if (stepSpecified) {
                     return (new Integer(step));
-                else
-                    return null;
+                }
+                return null;
             }
         }
 
@@ -375,8 +375,9 @@
          * implementation, we just need one per instance, but I'd rather
          * not keep the reference around once release() has been called.
          */
-        if (status == null)
+        if (status == null) {
             status = new Status();
+        }
 
         return status;
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/LowerCaseTag.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/LowerCaseTag.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/LowerCaseTag.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/LowerCaseTag.java
Mon Mar 21 01:15:22 2005
@@ -20,7 +20,7 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: LowerCaseTag.java,v 1.3 2004/03/05 13:02:25 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class LowerCaseTag extends StringTagSupport {
 
@@ -31,8 +31,7 @@
         LocaleTag localeTag = (LocaleTag) TagSupport.findAncestorWithClass(this, LocaleTag.class);
         if (localeTag == null) {
             return str.toLowerCase();
-        } else {
-            return str.toLowerCase(localeTag.getLocale());
         }
+        return str.toLowerCase(localeTag.getLocale());
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/UpperCaseTag.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/UpperCaseTag.java?view=diff&r1=158422&r2=158423
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/UpperCaseTag.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/taglib/java/org/apache/cocoon/taglib/string/UpperCaseTag.java
Mon Mar 21 01:15:22 2005
@@ -20,7 +20,7 @@
 
 /**
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @version CVS $Id: UpperCaseTag.java,v 1.3 2004/03/05 13:02:25 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class UpperCaseTag extends StringTagSupport {
 
@@ -31,9 +31,8 @@
         LocaleTag localeTag = (LocaleTag) TagSupport.findAncestorWithClass(this, LocaleTag.class);
         if (localeTag == null) {
             return str.toUpperCase();
-        } else {
-            return str.toUpperCase(localeTag.getLocale());
         }
+        return str.toUpperCase(localeTag.getLocale());
     }
 
 }



Mime
View raw message