Thanks for doing this. Did you also delete ElementAttributeMatching from
the util directory?
[EMAIL PROTECTED] said:
Author: cziegeler
Date: Tue May 2 02:41:56 2006
New Revision: 398882
URL: http://svn.apache.org/viewcvs?rev=398882view=rev
Log:
Merge changes from 2.1.x
Modified:
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/EncodeURLTransformer.java
Modified:
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/EncodeURLTransformer.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/EncodeURLTransformer.java?rev=398882r1=398881r2=398882view=diff
==
---
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/EncodeURLTransformer.java
(original)
+++
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/transformation/EncodeURLTransformer.java
Tue May 2 02:41:56 2006
@@ -17,12 +17,14 @@
import java.io.IOException;
import java.util.Map;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.util.ElementAttributeMatching;
import org.apache.cocoon.caching.CacheableProcessingComponent;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
@@ -31,7 +33,6 @@
import org.apache.cocoon.environment.SourceResolver;
import org.apache.excalibur.source.SourceValidity;
import org.apache.excalibur.source.impl.validity.NOPValidity;
-import org.apache.regexp.RESyntaxException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -105,13 +106,13 @@
* Configuration default exclude pattern,
* ie img/@src
*/
-public final static String EXCLUDE_NAME_DEFAULT = img/@src;
+public final static String EXCLUDE_NAME_DEFAULT = img/@src=;
/**
* Configuration default exclude pattern,
* ie .*\/@href|.*\/@action|frame/@src
*/
-public final static String INCLUDE_NAME_DEFAULT =
.*/@href|.*/@action|frame/@src;
+public final static String INCLUDE_NAME_DEFAULT =
.*/@href=|.*/@action=|frame/@src=;
private String includeNameConfigure = INCLUDE_NAME_DEFAULT;
private String excludeNameConfigure = EXCLUDE_NAME_DEFAULT;
@@ -168,7 +169,7 @@
this.excludeNameConfigure);
try {
this.elementAttributeMatching = new
ElementAttributeMatching(includeName, excludeName);
-} catch (RESyntaxException reex) {
+} catch (PatternSyntaxException reex) {
final String message = Cannot parse include-name: +
includeName + +
or exclude-name: + excludeName + !;
throw new ProcessingException(message, reex);
@@ -307,6 +308,108 @@
encoded_url = url;
}
return encoded_url;
+}
+
+/**
+ * A helper class for matching element names, and attribute names.
+ *
+ * p
+ * For given include-name, exclude-name decide if element-attribute
pair
+ * matches. This class defines the precedence and matching
algorithm.
+ * /p
+ *
+ * @author a href=mailto:[EMAIL PROTECTED]Bernhard Huber/a
+ * @versionCVS $Id$
+ */
+public static class ElementAttributeMatching {
+/**
+ * Regular expression of including patterns
+ *
+ */
+protected Pattern includeNameRE;
+/**
+ * Regular expression of excluding patterns
+ *
+ */
+protected Pattern excludeNameRE;
+
+
+/**
+ *Constructor for the ElementAttributeMatching object
+ *
+ * @param includeNameDescription of Parameter
+ * @param excludeNameDescription of Parameter
+ * @exception PatternSyntaxException Description of Exception
+ */
+public ElementAttributeMatching(String includeName, String
excludeName) throws PatternSyntaxException {
+includeNameRE = Pattern.compile(includeName,
Pattern.CASE_INSENSITIVE);
+excludeNameRE = Pattern.compile(excludeName,
Pattern.CASE_INSENSITIVE);
+}
+
+
+/**
+ * Return true iff element_name attr_name pair is not matched by
exclude-name,
+ * but is matched by include-name
+ * @param element_name
+ * @param attr_name
+ *