Package org.apache.tapestry5.util
Class TextStreamResponse
- java.lang.Object
-
- org.apache.tapestry5.util.TextStreamResponse
-
- All Implemented Interfaces:
StreamResponse
public class TextStreamResponse extends java.lang.Object implements StreamResponse
-
-
Constructor Summary
Constructors Constructor Description TextStreamResponse(java.lang.String contentType, java.lang.String text)Constructor that defaults the character set to "utf-8".TextStreamResponse(java.lang.String contentType, java.lang.String charset, java.lang.String text)Constructor allowing the content type and character set to the specified.TextStreamResponse(ContentType contentType, java.lang.String text)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()Returns the content type to be reported to the client.java.io.InputStreamgetStream()Converts the text to a byte array (as per the character set, which is usually "UTF-8"), and returns a stream for that byte array.voidprepareResponse(Response response)Does nothing; subclasses may override.
-
-
-
Constructor Detail
-
TextStreamResponse
public TextStreamResponse(java.lang.String contentType, java.lang.String text)
Constructor that defaults the character set to "utf-8".
-
TextStreamResponse
public TextStreamResponse(java.lang.String contentType, java.lang.String charset, java.lang.String text)
Constructor allowing the content type and character set to the specified.- Parameters:
contentType- type of content, often "text/xml"charset- character set of output, usually "UTF-8"text- text to be streamed in the response- See Also:
TapestryHttpSymbolConstants.CHARSET
-
TextStreamResponse
public TextStreamResponse(ContentType contentType, java.lang.String text)
-
-
Method Detail
-
getContentType
public java.lang.String getContentType()
Description copied from interface:StreamResponseReturns the content type to be reported to the client.- Specified by:
getContentTypein interfaceStreamResponse
-
getStream
public java.io.InputStream getStream() throws java.io.IOException
Converts the text to a byte array (as per the character set, which is usually "UTF-8"), and returns a stream for that byte array.- Specified by:
getStreamin interfaceStreamResponse- Returns:
- the text as a byte array stram
- Throws:
java.io.IOException
-
prepareResponse
public void prepareResponse(Response response)
Does nothing; subclasses may override.- Specified by:
prepareResponsein interfaceStreamResponse- Parameters:
response- Response that will be sent.
-
-