org.apache.cocoon.environment
Class ForwardRedirector

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.environment.ForwardRedirector
All Implemented Interfaces:
LogEnabled, PermanentRedirector, Redirector

public abstract class ForwardRedirector
extends AbstractLogEnabled
implements Redirector, PermanentRedirector

A base class for Redirectors that handle forward redirects, i.e. internal redirects using the "cocoon:" pseudo-protocol.

Concrete subclasses have to define the cocoonRedirect() method.

Version:
CVS $Id: ForwardRedirector.java 30941 2004-07-29 19:56:58Z vgritsenko $
Author:
Sylvain Wallez

Field Summary
protected  Environment env
          The Environment to use for redirection (either internal or external)
 
Constructor Summary
ForwardRedirector(Environment env)
          Constructor
 
Method Summary
protected abstract  void cocoonRedirect(String uri)
           
protected  void doRedirect(boolean sessionmode, String newURL, boolean permanent, boolean global)
          Redirect the client to new URL with session mode
 void globalRedirect(boolean sessionMode, String url)
          Unconditionally redirects to a given URL, even it this redirector is part of a subpipeline.
 boolean hasRedirected()
          Was one of the redirection methods called ?
 void permanentRedirect(boolean sessionMode, String url)
          Redirect to the given URL
 void redirect(boolean sessionMode, String url)
          Redirects to a given URL.
 void sendStatus(int sc)
          Send a content-less response with the given status code.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected Environment env
The Environment to use for redirection (either internal or external)

Constructor Detail

ForwardRedirector

public ForwardRedirector(Environment env)
Constructor

Method Detail

redirect

public void redirect(boolean sessionMode,
                     String url)
              throws IOException,
                     ProcessingException
Redirects to a given URL. If this URL starts with "cocoon:", then an internal redirect is performed. Otherwise, an external redirect is send to the environment.

Specified by:
redirect in interface Redirector
Throws:
IOException
ProcessingException

permanentRedirect

public void permanentRedirect(boolean sessionMode,
                              String url)
                       throws IOException,
                              ProcessingException
Description copied from interface: PermanentRedirector
Redirect to the given URL

Specified by:
permanentRedirect in interface PermanentRedirector
Throws:
IOException
ProcessingException

globalRedirect

public void globalRedirect(boolean sessionMode,
                           String url)
                    throws IOException,
                           ProcessingException
Unconditionally redirects to a given URL, even it this redirector is part of a subpipeline.

Specified by:
globalRedirect in interface Redirector
Throws:
IOException
ProcessingException

cocoonRedirect

protected abstract void cocoonRedirect(String uri)
                                throws IOException,
                                       ProcessingException
Throws:
IOException
ProcessingException

hasRedirected

public boolean hasRedirected()
Description copied from interface: Redirector
Was one of the redirection methods called ?

Specified by:
hasRedirected in interface Redirector

sendStatus

public void sendStatus(int sc)
Description copied from interface: Redirector
Send a content-less response with the given status code.

Specified by:
sendStatus in interface Redirector
Parameters:
sc - an http status code.

doRedirect

protected void doRedirect(boolean sessionmode,
                          String newURL,
                          boolean permanent,
                          boolean global)
                   throws IOException
Redirect the client to new URL with session mode

Throws:
IOException


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.