in a c2 project i'm working on, we're using the request parameter matcher
to match values that we then use in the generator's source url:
<map:match pattern="nlm/query">
<map:match type="request" pattern="author">
<map:generate
src="http://www.ncbi.nlm.nih.gov/entrez/utils/pmqty.fcgi?db=PubMed&mode=XML&dispmax=999&term={1}[au]"/>
<map:serialize/>
</map:match>
</map:match>
problem was, the request parameter could contain spaces and other fun
characters, and the value wasn't being urlencoded. i've attached a patch
for the sitemap which adds urlencoding to the subst method, but i don't
know that that's appropriate for all cases. can y'all think of anything
this would break?
- donald
Index: src/java/org/apache/cocoon/sitemap/AbstractSitemap.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/AbstractSitemap.java,v
retrieving revision 1.10
diff -u -3 -p -c -r1.10 AbstractSitemap.java
*** src/java/org/apache/cocoon/sitemap/AbstractSitemap.java 22 Feb 2002 07:03:55
-0000 1.10
--- src/java/org/apache/cocoon/sitemap/AbstractSitemap.java 19 Mar 2002 05:58:36
-0000
*************** import java.io.IOException;
*** 82,87 ****
--- 82,88 ----
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
+ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
*************** public abstract class AbstractSitemap ex
*** 349,355 ****
}
Object value = ((Map)list.get(k)).get(s);
if (value != null){
! result.append(value.toString());
getLogger().debug("Substitute evaluated value for " + s + " as "
+ value);
}else{
getLogger().warn("Substitute: value not found for " + s + "
while evaluating " + expr);
--- 350,356 ----
}
Object value = ((Map)list.get(k)).get(s);
if (value != null){
! result.append(URLEncoder.encode(value.toString()));
getLogger().debug("Substitute evaluated value for " + s + " as "
+ value);
}else{
getLogger().warn("Substitute: value not found for " + s + "
while evaluating " + expr);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]