cziegeler    01/09/04 07:44:13

  Modified:    src/org/apache/cocoon/components/source SitemapSource.java
               src/org/apache/cocoon/environment AbstractEnvironment.java
               src/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
               src/org/apache/cocoon/sitemap Manager.java
  Log:
  Fixed proper handling of cocoon: urls
  
  Revision  Changes    Path
  1.18      +5 -7      
xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SitemapSource.java        2001/08/25 19:40:32     1.17
  +++ SitemapSource.java        2001/09/04 14:44:12     1.18
  @@ -3,7 +3,7 @@
    * ------------------------------------------------------------------------- *
    * This software is published under the terms of the Apache Software License *
    * version 1.1, a copy of which has been included  with this distribution in *
  - * the LICENSE file.                                                         *
  + * the LICENSE file.                               s                          *
    *****************************************************************************/
   
   package org.apache.cocoon.components.source;
  @@ -47,7 +47,7 @@
    * Description of a source which is defined by a pipeline.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.17 $ $Date: 2001/08/25 19:40:32 $
  + * @version CVS $Revision: 1.18 $ $Date: 2001/09/04 14:44:12 $
    */
   
   public final class SitemapSource
  @@ -98,7 +98,7 @@
       throws IOException, ProcessingException {
   
           this.manager = manager;
  -
  +        this.setLogger(logger);
           // remove the protocol
           int protocolEnd = uri.indexOf(':');
           if (protocolEnd != -1) {
  @@ -143,7 +143,6 @@
               uri = uri.substring(0, queryStringPos);
           }
           this.uri = uri;
  -        this.environment.setURI(this.prefix, this.uri);
           this.refresh();
       }
   
  @@ -234,11 +233,11 @@
               ((XMLProducer)eventPipeline).setConsumer(this);
   
               this.environment.setURI(this.prefix, this.uri);
  -                this.processor.process(this.environment, pipeline, eventPipeline);
  +            this.processor.process(this.environment, pipeline, eventPipeline);
  +            this.environment.changeToLastContext();
                   String redirectURL = this.environment.getRedirectURL();
                   if (redirectURL == null) {
                       if (this.eventPipeline instanceof CacheableEventPipeline) {
  -                    this.environment.setURI(this.prefix, this.uri);
                           CacheableEventPipeline cep = 
(CacheableEventPipeline)this.eventPipeline;
                           PipelineCacheKey pck = cep.generateKey(this.environment);
                           Map validity = null;
  @@ -288,7 +287,6 @@
               if (this.redirectSource != null) {
                   this.redirectSource.toSAX(consumer);
               } else {
  -                this.environment.setURI(this.prefix, this.uri);
                   ((XMLProducer)eventPipeline).setConsumer(consumer);
                   eventPipeline.process(this.environment);
               }
  
  
  
  1.19      +1 -9      
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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractEnvironment.java  2001/08/30 15:17:03     1.18
  +++ AbstractEnvironment.java  2001/09/04 14:44:12     1.19
  @@ -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.18 $ $Date: 2001/08/30 15:17:03 $
  + * @version CVS $Revision: 1.19 $ $Date: 2001/09/04 14:44:12 $
    */
   public abstract class AbstractEnvironment extends AbstractLoggable implements 
Environment {
   
  @@ -118,14 +118,6 @@
        */
       public String getURI() {
           return this.uris;
  -    }
  -
  -    /**
  -     * Set the uri in progress. The prefix is stripped off
  -     */
  -    public void setURI(String uris) {
  -        getLogger().debug("Set the URIs (OLD=" + this.uris + ", NEW=" + uris + ")");
  -        this.uris = uris;
       }
   
       /**
  
  
  
  1.9       +31 -2     
xml-cocoon2/src/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- EnvironmentWrapper.java   2001/08/30 15:17:03     1.8
  +++ EnvironmentWrapper.java   2001/09/04 14:44:12     1.9
  @@ -18,6 +18,7 @@
   import java.io.IOException;
   import java.io.OutputStream;
   import java.net.MalformedURLException;
  +import java.net.URL;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  @@ -29,7 +30,7 @@
    * contains a <code>RequestWrapper</code> object.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version $Id: EnvironmentWrapper.java,v 1.8 2001/08/30 15:17:03 dims Exp $
  + * @version $Id: EnvironmentWrapper.java,v 1.9 2001/09/04 14:44:12 cziegeler Exp $
    */
   public final class EnvironmentWrapper
   extends AbstractEnvironment
  @@ -47,6 +48,13 @@
       /** The request object */
       private Request request;
   
  +    /** The last context */
  +    private URL lastContext;
  +    /** The last prefix */
  +    private String lastPrefix;
  +    /** The last uri */
  +    private String lastURI;
  +
       /**
        * Constructs an EnvironmentWrapper object from a Request
        * and Response objects
  @@ -154,11 +162,32 @@
        * context and the prefix is set.
        */
       public void setURI(String prefix, String uris) {
  +        getLogger().debug("Setting uri (prefix=" + prefix + ", uris=" + uris + ")");
           if (prefix != null) {
               setContext(getRootContext());
               setURIPrefix(prefix);
           }
  -        setURI(uris);
  +        this.uris = uris;
  +        this.lastURI = uris;
  +        this.lastContext = this.context;
  +        this.lastPrefix = this.prefix.toString();
  +    }
  +
  +    public void changeContext(String prefix, String context)
  +    throws MalformedURLException {
  +        super.changeContext(prefix, context);
  +        this.lastContext = this.context;
  +        this.lastPrefix  = this.prefix.toString();
  +        this.lastURI     = this.uris;
  +    }
  +
  +    /**
  +     * Change the current context to the last one set by changeContext()
  +     */
  +    public void changeToLastContext() {
  +        this.setContext(this.lastContext);
  +        this.setURIPrefix(this.lastPrefix);
  +        this.uris = this.lastURI;
       }
   }
   
  
  
  
  1.14      +3 -3      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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Manager.java      2001/08/30 19:15:43     1.13
  +++ Manager.java      2001/09/04 14:44:13     1.14
  @@ -36,10 +36,10 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
  - * @version CVS $Revision: 1.13 $ $Date: 2001/08/30 19:15:43 $
  + * @version CVS $Revision: 1.14 $ $Date: 2001/09/04 14:44:13 $
    */
  -public class Manager 
  -        extends AbstractLoggable 
  +public class Manager
  +        extends AbstractLoggable
           implements Component, Configurable, Composable, Contextualizable, 
ThreadSafe, LogKitManageable {
       private Context context;
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to