org.apache.cocoon.environment
Class ForwardRedirector

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.environment.ForwardRedirector
All Implemented Interfaces:
org.apache.cocoon.environment.PermanentRedirector, org.apache.cocoon.environment.Redirector

public abstract class ForwardRedirector
extends org.apache.cocoon.util.AbstractLogEnabled
implements org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.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:
$Id: ForwardRedirector.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  org.apache.cocoon.environment.Environment env
          The Environment to use for redirection (either internal or external)
 
Constructor Summary
ForwardRedirector(org.apache.cocoon.environment.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()
           
 void permanentRedirect(boolean sessionMode, String url)
           
 void redirect(boolean sessionMode, String url)
          Redirects to a given URL.
 void sendStatus(int sc)
           
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected org.apache.cocoon.environment.Environment env
The Environment to use for redirection (either internal or external)

Constructor Detail

ForwardRedirector

public ForwardRedirector(org.apache.cocoon.environment.Environment env)
Constructor

Method Detail

redirect

public void redirect(boolean sessionMode,
                     String url)
              throws IOException,
                     org.apache.cocoon.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 org.apache.cocoon.environment.Redirector
Throws:
IOException
org.apache.cocoon.ProcessingException

permanentRedirect

public void permanentRedirect(boolean sessionMode,
                              String url)
                       throws IOException,
                              org.apache.cocoon.ProcessingException
Specified by:
permanentRedirect in interface org.apache.cocoon.environment.PermanentRedirector
Throws:
IOException
org.apache.cocoon.ProcessingException

globalRedirect

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

Specified by:
globalRedirect in interface org.apache.cocoon.environment.Redirector
Throws:
IOException
org.apache.cocoon.ProcessingException

cocoonRedirect

protected abstract void cocoonRedirect(String uri)
                                throws IOException,
                                       org.apache.cocoon.ProcessingException
Throws:
IOException
org.apache.cocoon.ProcessingException

hasRedirected

public boolean hasRedirected()
Specified by:
hasRedirected in interface org.apache.cocoon.environment.Redirector

sendStatus

public void sendStatus(int sc)
Specified by:
sendStatus in interface org.apache.cocoon.environment.Redirector

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-2008 The Apache Software Foundation. All Rights Reserved.