org.apache.velocity.tools.view
Class ImportSupport.ImportResponseWrapper

java.lang.Object
  extended by HttpServletResponseWrapper
      extended by org.apache.velocity.tools.view.ImportSupport.ImportResponseWrapper
Enclosing class:
ImportSupport

protected static class ImportSupport.ImportResponseWrapper
extends HttpServletResponseWrapper

Wraps responses to allow us to retrieve results as Strings.


Field Summary
private  java.io.ByteArrayOutputStream bos
          A buffer, alternatively, to accumulate bytes.
private  boolean isStreamUsed
          'True if getOutputStream() was called; false otherwise.
private  boolean isWriterUsed
          'True' if getWriter() was called; false otherwise.
private  int status
          The HTTP status set by the target.
private  java.io.StringWriter sw
          The Writer we convey.
 
Constructor Summary
ImportSupport.ImportResponseWrapper(HttpServletResponse response)
          Constructs a new ImportResponseWrapper.
 
Method Summary
 ServletOutputStream getOutputStream()
           
 int getStatus()
           
 java.lang.String getString()
          Retrieves the buffered output, using the containing tag's 'charEncoding' attribute, or the tag's default encoding, if necessary.
 java.io.PrintWriter getWriter()
           
 void setContentType(java.lang.String x)
          Has no effect.
 void setLocale(java.util.Locale x)
          Has no effect.
 void setStatus(int status)
          Sets the status of the response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sw

private java.io.StringWriter sw
The Writer we convey.


bos

private java.io.ByteArrayOutputStream bos
A buffer, alternatively, to accumulate bytes.


isWriterUsed

private boolean isWriterUsed
'True' if getWriter() was called; false otherwise.


isStreamUsed

private boolean isStreamUsed
'True if getOutputStream() was called; false otherwise.


status

private int status
The HTTP status set by the target.

Constructor Detail

ImportSupport.ImportResponseWrapper

public ImportSupport.ImportResponseWrapper(HttpServletResponse response)
Constructs a new ImportResponseWrapper.

Parameters:
response - the response to wrap
Method Detail

getWriter

public java.io.PrintWriter getWriter()
Returns:
a Writer designed to buffer the output.

getOutputStream

public ServletOutputStream getOutputStream()
Returns:
a ServletOutputStream designed to buffer the output.

setContentType

public void setContentType(java.lang.String x)
Has no effect.


setLocale

public void setLocale(java.util.Locale x)
Has no effect.


setStatus

public void setStatus(int status)
Sets the status of the response

Parameters:
status - the status code

getStatus

public int getStatus()
Returns:
the status of the response

getString

public java.lang.String getString()
                           throws java.io.UnsupportedEncodingException
Retrieves the buffered output, using the containing tag's 'charEncoding' attribute, or the tag's default encoding, if necessary.

Returns:
the buffered output
Throws:
java.io.UnsupportedEncodingException - if the encoding is not supported


Copyright (c) 2003-2007 Apache Software Foundation