cziegeler 01/09/04 08:23:03
Modified: src/org/apache/cocoon/environment AbstractEnvironment.java
Environment.java
src/org/apache/cocoon/sitemap Manager.java
Log:
Changed restoring of old context after the subsitemap is processed
Revision Changes Path
1.20 +12 -17
xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- AbstractEnvironment.java 2001/09/04 14:44:12 1.19
+++ AbstractEnvironment.java 2001/09/04 15:23:03 1.20
@@ -24,7 +24,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.19 $ $Date: 2001/09/04 14:44:12 $
+ * @version CVS $Revision: 1.20 $ $Date: 2001/09/04 15:23:03 $
*/
public abstract class AbstractEnvironment extends AbstractLoggable implements
Environment {
@@ -128,14 +128,6 @@
}
/**
- * Set the Root Context
- */
- public void setRootContext(URL rootContext) {
- getLogger().debug("Set the root context (OLD=" + this.rootContext + ",
NEW=" + rootContext + ")");
- this.rootContext = rootContext;
- }
-
- /**
* Get the current Context
*/
public URL getContext() {
@@ -143,14 +135,6 @@
}
/**
- * Set the current Context
- */
- public void setContext(URL context) {
- getLogger().debug("Forcing a context (OLD=" + this.context + ", NEW=" +
context + ")");
- this.context = context;
- }
-
- /**
* Get the prefix of the URI in progress
*/
public String getURIPrefix() {
@@ -163,6 +147,17 @@
public void setURIPrefix(String prefix) {
getLogger().debug("Set the URI Prefix (OLD=" + this.prefix.toString() + ",
NEW=" + prefix + ")");
this.prefix = new StringBuffer(prefix);
+ }
+
+ /**
+ * Set the context. This is similar to changeContext()
+ * except that it is absolute.
+ */
+ public void setContext(String prefix, String uri) {
+ this.setContext(getRootContext());
+ this.setURIPrefix(prefix == null ? "" : prefix);
+ this.uris = uri;
+ getLogger().debug("Reset context to " + this.context);
}
/**
1.11 +11 -7 xml-cocoon2/src/org/apache/cocoon/environment/Environment.java
Index: Environment.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Environment.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Environment.java 2001/08/20 21:47:30 1.10
+++ Environment.java 2001/09/04 15:23:03 1.11
@@ -20,7 +20,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.10 $ $Date: 2001/08/20 21:47:30 $
+ * @version CVS $Revision: 1.11 $ $Date: 2001/09/04 15:23:03 $
*/
public interface Environment extends SourceResolver {
@@ -46,16 +46,14 @@
String getURIPrefix();
/**
- * Get current context
+ * Get the Root Context
*/
- URL getContext();
-
- void setContext(URL url);
+ URL getRootContext();
/**
- * Get the Root Context
+ * Get current context
*/
- URL getRootContext();
+ URL getContext();
/**
* Get the view to process
@@ -66,6 +64,12 @@
* Get the action to process
*/
String getAction();
+
+ /**
+ * Set the context. This is similar to changeContext()
+ * except that it is absolute.
+ */
+ void setContext(String prefix, String uri);
/**
* Change the context from uriprefix to context
1.15 +11 -9 xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java
Index: Manager.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Manager.java 2001/09/04 14:44:13 1.14
+++ Manager.java 2001/09/04 15:23:03 1.15
@@ -36,7 +36,7 @@
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.14 $ $Date: 2001/09/04 14:44:13 $
+ * @version CVS $Revision: 1.15 $ $Date: 2001/09/04 15:23:03 $
*/
public class Manager
extends AbstractLoggable
@@ -109,12 +109,13 @@
Handler sitemapHandler = getHandler(newManager, environment, source,
check_reload, reload_asynchron);
// setup to invoke the processing
setupProcessing(environment, sitemapHandler, uri_prefix, source);
- URL context = environment.getContext();
- try{
+ String prefix = environment.getURIPrefix();
+ String uri = environment.getURI();
+ try {
environment.changeContext(uri_prefix, source);
return sitemapHandler.process(environment);
- }finally{
- environment.setContext(context);
+ } finally{
+ environment.setContext(prefix, uri);
}
}
@@ -133,12 +134,13 @@
Handler sitemapHandler = getHandler(newManager, environment, source,
check_reload, reload_asynchron);
// setup to invoke the processing
setupProcessing(environment, sitemapHandler, uri_prefix, source);
- URL context = environment.getContext();
- try{
+ String prefix = environment.getURIPrefix();
+ String uri = environment.getURI();
+ try {
environment.changeContext(uri_prefix, source);
return sitemapHandler.process(environment, pipeline, eventPipeline);
- }finally{
- environment.setContext(context);
+ } finally{
+ environment.setContext(prefix, uri);
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]