Package org.apache.velocity.tools.view
Class ImportSupport.ImportResponseWrapper
java.lang.Object
HttpServletResponseWrapper
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
FieldsModifier and TypeFieldDescriptionprivate ByteArrayOutputStream
A buffer, alternatively, to accumulate bytes.private boolean
'True if getOutputStream() was called; false otherwise.private boolean
'True' if getWriter() was called; false otherwise.private int
The HTTP status set by the target.private StringWriter
The Writer we convey. -
Constructor Summary
ConstructorsConstructorDescriptionImportResponseWrapper
(HttpServletResponse response) Constructs a new ImportResponseWrapper. -
Method Summary
Modifier and TypeMethodDescriptionServletOutputStream
int
Retrieves the buffered output, using the containing tag's 'charEncoding' attribute, or the tag's default encoding, if necessary.void
Has no effect.void
Has no effect.void
setStatus
(int status) Sets the status of the response
-
Field Details
-
sw
The Writer we convey. -
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 statusThe HTTP status set by the target.
-
-
Constructor Details
-
ImportResponseWrapper
public ImportResponseWrapper(HttpServletResponse response) Constructs a new ImportResponseWrapper.- Parameters:
response
- the response to wrap
-
-
Method Details
-
getWriter
- Returns:
- a Writer designed to buffer the output.
-
getOutputStream
public ServletOutputStream getOutputStream()- Returns:
- a ServletOutputStream designed to buffer the output.
-
setContentType
Has no effect. -
setLocale
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
Retrieves the buffered output, using the containing tag's 'charEncoding' attribute, or the tag's default encoding, if necessary.- Returns:
- the buffered output
- Throws:
UnsupportedEncodingException
- if the encoding is not supported
-