cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timm, Sean" <ST...@mailgo.com>
Subject FW: [PATCH] XSLT processor fixed to properly reload stylesheets i f changed
Date Tue, 15 Feb 2000 17:35:23 GMT
I'm sending this once again because I once again didn't receive this even
though it's in the archive.  Did anyone receive the original message?  The
mailing lists have seemed kind of flaky to me lately...

- Sean T.

-----Original Message-----
From: Timm, Sean 
Sent: Monday, February 14, 2000 1:30 PM
To: 'cocoon-dev@xml.apache.org'
Subject: [PATCH] XSLT processor fixed to properly reload stylesheets if
changed


I figured out the problem I was seeing with XSLT stylesheets being cached
off even though they had changed.  We are dynamically determining the
stylesheet to display for a specific URL based on various factors, but the
XSLT processor was only looking at the request object to determine if the
resource had changed.  In our case, the requested resource was the same, but
the XSL filename was different.  I modified the processor to tack on the
name of the XSL processor to the lookup key.

The changes are as follows:
Index: XSLTProcessor.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/processor/xslt/XSLTProcesso
r.java,v
retrieving revision 1.6
diff -u -r1.6 XSLTProcessor.java
--- XSLTProcessor.java	2000/02/13 18:29:34	1.6
+++ XSLTProcessor.java	2000/02/14 20:25:35
@@ -158,11 +158,11 @@
 
         try {
             Document sheet;
-            
-            if (this.hasChanged(request)) {
+            String stylesheetKey = Utils.encode(request, true) +
resource.toString();
+            if (this.hasChanged(stylesheetKey)) {
                 sheet = getDocument(resource);
                 this.store.hold(resource, sheet);
-                this.monitor.watch(Utils.encode(request, true), resource);
+                this.monitor.watch(stylesheetKey, resource);
             } else {
                 Object o = this.store.get(resource);
                 if (o != null) {
@@ -170,6 +170,7 @@
                 } else {
                     sheet  = getDocument(resource);
                     this.store.hold(resource, sheet);
+                    this.monitor.watch(stylesheetKey, resource);
                 }
             }
             
@@ -198,7 +199,7 @@
     }
     
     public boolean hasChanged(Object context) {
-        return this.monitor.hasChanged(Utils.encode((HttpServletRequest)
context, true));
+        return this.monitor.hasChanged((String)context);
     }
     
     public String getStatus() {

Mime
View raw message