org.apache.cocoon.environment.http
Class HttpEnvironment

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.environment.AbstractEnvironment
              |
              +--org.apache.cocoon.environment.http.HttpEnvironment
All Implemented Interfaces:
Environment, org.apache.avalon.framework.logger.Loggable, Redirector, SourceResolver

public class HttpEnvironment
extends AbstractEnvironment
implements Redirector

Version:
CVS $Id: HttpEnvironment.java,v 1.12.2.3 2002/10/29 04:48:59 vgritsenko Exp $
Author:
?

Field Summary
static java.lang.String HTTP_REQUEST_OBJECT
           
static java.lang.String HTTP_RESPONSE_OBJECT
           
static java.lang.String HTTP_SERVLET_CONTEXT
           
 
Fields inherited from class org.apache.cocoon.environment.AbstractEnvironment
action, context, manager, objectModel, prefix, rootContext, sourceHandler, uris, view
 
Constructor Summary
HttpEnvironment(java.lang.String uri, java.net.URL rootURL, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.ServletContext servletContext, HttpContext context, java.lang.String containerEncoding, java.lang.String defaultFormEncoding, RequestFactory requestFactory)
          Constructs a HttpEnvironment object from a HttpServletRequest and HttpServletResponse objects
 
Method Summary
 java.lang.String getContentType()
          Get the ContentType
 java.io.OutputStream getOutputStream()
          Get the OutputStream
 boolean hasRedirected()
          Was one of the redirection methods called ?
 boolean isResponseModified(long lastModified)
          Check if the response has been modified since the same "resource" was requested.
 void redirect(boolean sessionmode, java.lang.String newURL)
          Redirect the client to new URL with session mode
 void setContentLength(int length)
          Set the length of the generated content
 void setContentType(java.lang.String contentType)
          Set the ContentType
 void setResponseIsNotModified()
          Mark the response as not modified.
 void setStatus(int statusCode)
          Set the StatusCode
 boolean tryResetResponse()
          Reset the response if possible.
 
Methods inherited from class org.apache.cocoon.environment.AbstractEnvironment
changeContext, getAction, getAttribute, getAttributeNames, getComponentManager, getContext, getObjectModel, getRootContext, getSourceHandler, getURI, getURIPrefix, getView, globalRedirect, removeAttribute, resolve, setAttribute, setComponentManager, setContext, setContext, setSourceHandler, setURIPrefix
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.environment.Redirector
globalRedirect
 

Field Detail

HTTP_REQUEST_OBJECT

public static final java.lang.String HTTP_REQUEST_OBJECT

HTTP_RESPONSE_OBJECT

public static final java.lang.String HTTP_RESPONSE_OBJECT

HTTP_SERVLET_CONTEXT

public static final java.lang.String HTTP_SERVLET_CONTEXT
Constructor Detail

HttpEnvironment

public HttpEnvironment(java.lang.String uri,
                       java.net.URL rootURL,
                       javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res,
                       javax.servlet.ServletContext servletContext,
                       HttpContext context,
                       java.lang.String containerEncoding,
                       java.lang.String defaultFormEncoding,
                       RequestFactory requestFactory)
                throws java.net.MalformedURLException,
                       java.io.IOException
Constructs a HttpEnvironment object from a HttpServletRequest and HttpServletResponse objects
Method Detail

redirect

public void redirect(boolean sessionmode,
                     java.lang.String newURL)
              throws java.io.IOException
Redirect the client to new URL with session mode
Specified by:
redirect in interface Redirector
Overrides:
redirect in class AbstractEnvironment

hasRedirected

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

setStatus

public void setStatus(int statusCode)
Set the StatusCode
Overrides:
setStatus in class AbstractEnvironment

setContentType

public void setContentType(java.lang.String contentType)
Set the ContentType

getContentType

public java.lang.String getContentType()
Get the ContentType

setContentLength

public void setContentLength(int length)
Set the length of the generated content

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get the OutputStream

isResponseModified

public boolean isResponseModified(long lastModified)
Check if the response has been modified since the same "resource" was requested. The caller has to test if it is really the same "resource" which is requested.
Overrides:
isResponseModified in class AbstractEnvironment
Returns:
true if the response is modified or if the environment is not able to test it

setResponseIsNotModified

public void setResponseIsNotModified()
Mark the response as not modified.
Overrides:
setResponseIsNotModified in class AbstractEnvironment

tryResetResponse

public boolean tryResetResponse()
Reset the response if possible. This allows error handlers to have a higher chance to produce clean output if the pipeline that raised the error has already output some data.
Overrides:
tryResetResponse in class AbstractEnvironment
Returns:
true if the response was successfully reset


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.