org.apache.cocoon.environment
Class ForwardRedirector

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.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.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Sylvain Wallez

Field Summary
protected  Environment env
          The Environment to use for redirection (either internal or external)
 
Constructor Summary
ForwardRedirector(Environment env)
           
 
Method Summary
protected abstract  void cocoonRedirect(String uri)
           
 void globalRedirect(boolean sessionMode, String url)
          Unconditionally redirects to a given URL, even it this redirector is part of a subpipeline.
 boolean hasRedirected()
          Perform check on whether redirection has occured or not
 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)
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()
Perform check on whether redirection has occured or not

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.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.