Hello Alexander,
On Monday 18 November 2002 09:54, Alexander Peters wrote:
>
> i'm trying to get cocoon using jakarta-slide as repository for the xml
> documents. While running the slide sample in the cvs/scratchpad
> (11.11.2002) i recognized that the sample is losing the principal-data at
> some places. For example:
>
> sitemap.xmap
> --------------
> <map:match pattern="view/**">
> - <map:read src="slide://{1}?cocoon-principal={../ID}"/>
> + <map:read src="slide://{1}?cocoon-source-principal={../ID}"/>
> </map:match>
Okay, this should fix the first problem.
> src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator
However SourceDescriptionGenerator does not forward the query string to its
children, so they don't get the principal. I would success the attached
changes.
Martin
Index: SourceDescriptionGenerator.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java,v
retrieving revision 1.14
diff -u -r1.14 SourceDescriptionGenerator.java
--- SourceDescriptionGenerator.java 22 Aug 2002 13:47:14 -0000 1.14
+++ SourceDescriptionGenerator.java 18 Nov 2002 15:54:18 -0000
@@ -167,6 +167,9 @@
/** Traversed source for the keys and validities */
private Hashtable cachedsources = new Hashtable();
+ /** The queryString of the location including the "?" */
+ private String queryString;
+
/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the request.
@@ -174,6 +177,14 @@
public void setup(SourceResolver resolver, Map objectModel, String location, Parameters parameters)
throws ProcessingException, SAXException, IOException {
+ int idx = location.indexOf('?');
+ if (idx != -1) {
+ this.queryString = location.substring(idx);
+ location = location.substring(0,idx);
+ } else {
+ this.queryString = "";
+ }
+
super.setup(resolver, objectModel, location, parameters);
this.properties = parameters.getParameterAsBoolean("properties", true);
@@ -235,7 +246,7 @@
private void collectSources(Hashtable sources, String uri, int deep) {
Source source = null;
try {
- source = this.resolver.resolveURI(uri);
+ source = this.resolver.resolveURI(uri + this.queryString);
} catch (Exception e) {
getLogger().warn("Could not retrieve source with the id '"+uri+"'", e);
return;
@@ -498,7 +509,8 @@
* All instance variables are set to <code>null</code>.
*/
public void recycle() {
-
+ this.queryString = null;
+
Object uri;
for (Enumeration e = cachedsources.keys(); e.hasMoreElements();) {
uri = e.nextElement();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]