org.apache.cocoon.environment.wrapper
Class EnvironmentWrapper

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.environment.AbstractEnvironment
          extended byorg.apache.cocoon.environment.wrapper.EnvironmentWrapper
All Implemented Interfaces:
org.apache.cocoon.environment.Environment
Direct Known Subclasses:
ForwardEnvironmentWrapper

public class EnvironmentWrapper
extends org.apache.cocoon.environment.AbstractEnvironment

This is a wrapper class for the Environment object. It has the same properties except that the object model contains a RequestWrapper object.

Version:
$Id: EnvironmentWrapper.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  String contentType
           
protected  org.apache.cocoon.environment.Environment environment
          The wrapped environment
protected  boolean internalRedirect
           
protected  String redirectURL
          The redirect url
protected  org.apache.cocoon.environment.Request request
          The request object
 
Fields inherited from class org.apache.cocoon.environment.AbstractEnvironment
action, objectModel, outputStream, prefix, secureOutputStream, uri, view
 
Constructor Summary
EnvironmentWrapper(org.apache.cocoon.environment.Environment env, SitemapSourceInfo info)
          Construct a new environment.
EnvironmentWrapper(org.apache.cocoon.environment.Environment env, SitemapSourceInfo info, boolean wrapResponse)
          Construct a new environment.
 
Method Summary
 void commitResponse()
           
 Object getAttribute(String name)
          Lookup an attribute in this instance, and if not found search it in the wrapped environment.
 String getContentType()
          Get the ContentType
 OutputStream getOutputStream(int bufferSize)
           
 String getRedirectURL()
          if a redirect should happen this returns the url, otherwise null is returned
 boolean isExternal()
          Always return false.
 boolean isInternalRedirect()
           
 void redirect(String newURL, boolean global, boolean permanent)
           
 void removeAttribute(String name)
          Remove attribute from the current instance, as well as from the wrapped environment.
 void reset()
           
 void setContentLength(int length)
           
 void setContentType(String contentType)
          Set the ContentType
 void setInternalRedirect(boolean flag)
           
 void setOutputStream(OutputStream stream)
          Set the output stream for this environment.
 void setStatus(int statusCode)
          Set the StatusCode
 boolean tryResetResponse()
           
 
Methods inherited from class org.apache.cocoon.environment.AbstractEnvironment
extractAction, extractView, finishingProcessing, getAction, getAttributeNames, getObjectModel, getURI, getURIPrefix, getView, isResponseModified, setAction, setAttribute, setResponseIsNotModified, setURI, setView, startingProcessing
 
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

environment

protected final org.apache.cocoon.environment.Environment environment
The wrapped environment


request

protected final org.apache.cocoon.environment.Request request
The request object


contentType

protected String contentType

redirectURL

protected String redirectURL
The redirect url


internalRedirect

protected boolean internalRedirect
Constructor Detail

EnvironmentWrapper

public EnvironmentWrapper(org.apache.cocoon.environment.Environment env,
                          SitemapSourceInfo info)
Construct a new environment.

Parameters:
env - The origial Environment
info - A description of the uri for the new environment

EnvironmentWrapper

public EnvironmentWrapper(org.apache.cocoon.environment.Environment env,
                          SitemapSourceInfo info,
                          boolean wrapResponse)
Construct a new environment.

Parameters:
env - The origial Environment
info - A description of the uri for the new environment
wrapResponse - Whether or not to wrap the Response object
Method Detail

redirect

public void redirect(String newURL,
                     boolean global,
                     boolean permanent)
              throws IOException
Throws:
IOException
See Also:
Environment.redirect(String, boolean, boolean)

getOutputStream

public OutputStream getOutputStream(int bufferSize)
                             throws IOException
Throws:
IOException
See Also:
Environment.getOutputStream(int)

setOutputStream

public void setOutputStream(OutputStream stream)
Set the output stream for this environment. It hides the one of the wrapped environment.


tryResetResponse

public boolean tryResetResponse()
                         throws IOException
Throws:
IOException
See Also:
Environment.tryResetResponse()

commitResponse

public void commitResponse()
                    throws IOException
Throws:
IOException
See Also:
Environment.commitResponse()

getRedirectURL

public String getRedirectURL()
if a redirect should happen this returns the url, otherwise null is returned


reset

public void reset()

setStatus

public void setStatus(int statusCode)
Set the StatusCode


setContentLength

public void setContentLength(int length)

setContentType

public void setContentType(String contentType)
Set the ContentType


getContentType

public String getContentType()
Get the ContentType


getAttribute

public Object getAttribute(String name)
Lookup an attribute in this instance, and if not found search it in the wrapped environment.

Parameters:
name - a String, the name of the attribute to look for
Returns:
an Object, the value of the attribute or null if no such attribute was found.

removeAttribute

public void removeAttribute(String name)
Remove attribute from the current instance, as well as from the wrapped environment.

Parameters:
name - a String value

isExternal

public boolean isExternal()
Always return false.


setInternalRedirect

public void setInternalRedirect(boolean flag)

isInternalRedirect

public boolean isInternalRedirect()
See Also:
Environment.isInternalRedirect()


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