cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/sitemap SitemapRedirector.java
Date Tue, 04 Dec 2001 19:05:36 GMT
tcurdt      01/12/04 11:05:36

  Modified:    src/org/apache/cocoon/environment AbstractEnvironment.java
                        Redirector.java
               src/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
               src/org/apache/cocoon/sitemap SitemapRedirector.java
  Log:
  added the globalRedirect method to the Redirector interface.
  now it's always possible to do a redirect on root level even
  from aggregated pipelines.
  
  Revision  Changes    Path
  1.27      +4 -1      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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- AbstractEnvironment.java	2001/11/26 11:36:16	1.26
  +++ AbstractEnvironment.java	2001/12/04 19:05:36	1.27
  @@ -26,7 +26,7 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.26 $ $Date: 2001/11/26 11:36:16 $
  + * @version CVS $Revision: 1.27 $ $Date: 2001/12/04 19:05:36 $
    */
   public abstract class AbstractEnvironment extends AbstractLoggable implements Environment
{
   
  @@ -228,6 +228,9 @@
        * Redirect the client to a new URL
        */
       public abstract void redirect(boolean sessionmode, String newURL) throws IOException;
  +    public void globalRedirect(boolean sessionmode, String newURL) throws IOException {
  +      redirect(sessionmode,newURL);
  +    }
   
       // Request methods
   
  
  
  
  1.2       +2 -1      xml-cocoon2/src/org/apache/cocoon/environment/Redirector.java
  
  Index: Redirector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Redirector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Redirector.java	2001/06/05 21:36:24	1.1
  +++ Redirector.java	2001/12/04 19:05:36	1.2
  @@ -14,7 +14,7 @@
    * Interface for an redirector abstraction
    *
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/06/05 21:36:24 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/12/04 19:05:36 $
    */
   
   public interface Redirector {
  @@ -23,5 +23,6 @@
        * Redirect to the given URL
        */
       void redirect(boolean sessionmode, String url) throws IOException;
  +    void globalRedirect(boolean sessionmode, String url) throws IOException;
   }
   
  
  
  
  1.12      +14 -1     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EnvironmentWrapper.java	2001/10/11 07:28:21	1.11
  +++ EnvironmentWrapper.java	2001/12/04 19:05:36	1.12
  @@ -30,7 +30,7 @@
    * contains a <code>RequestWrapper</code> object.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version $Id: EnvironmentWrapper.java,v 1.11 2001/10/11 07:28:21 cziegeler Exp $
  + * @version $Id: EnvironmentWrapper.java,v 1.12 2001/12/04 19:05:36 tcurdt Exp $
    */
   public final class EnvironmentWrapper
   extends AbstractEnvironment
  @@ -100,6 +100,19 @@
               // get session from request, or create new session
               session = request.getSession(true);
           }
  +    }
  +
  +    /**
  +     * Redirect in the first non-wrapped environment
  +     */
  +    public void globalRedirect(boolean sessionmode, String newURL)
  +    throws IOException {
  +       if (environment instanceof EnvironmentWrapper) {
  +         ((EnvironmentWrapper)environment).globalRedirect(sessionmode, newURL);
  +       }
  +       else {
  +         environment.redirect(sessionmode,newURL);
  +       }
       }
   
       /**
  
  
  
  1.6       +11 -1     xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapRedirector.java
  
  Index: SitemapRedirector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapRedirector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SitemapRedirector.java	2001/10/11 07:28:23	1.5
  +++ SitemapRedirector.java	2001/12/04 19:05:36	1.6
  @@ -10,6 +10,7 @@
   
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.Redirector;
  +import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
   
   import java.io.IOException;
   
  @@ -17,7 +18,7 @@
    * Wrapper for sitemap redirection
    *
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2001/10/11 07:28:23 $
  + * @version CVS $Revision: 1.6 $ $Date: 2001/12/04 19:05:36 $
    */
   public class SitemapRedirector implements Redirector {
       private boolean hasRedirected = false;
  @@ -35,6 +36,15 @@
        */
       public void redirect(boolean sessionMode, String url) throws IOException {
           e.redirect(sessionMode, url);
  +        this.hasRedirected = true;
  +    }
  +    public void globalRedirect(boolean sessionMode, String url) throws IOException {
  +        if (e instanceof EnvironmentWrapper) {
  +          ((EnvironmentWrapper)e).globalRedirect(sessionMode,url);
  +        }
  +        else {
  +          e.redirect(sessionMode, url);
  +        }
           this.hasRedirected = true;
       }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message