Package org.apache.tapestry5.util
Class TextStreamResponse
java.lang.Object
org.apache.tapestry5.util.TextStreamResponse
- All Implemented Interfaces:
StreamResponse
-
Constructor Summary
ConstructorsConstructorDescriptionTextStreamResponse
(String contentType, String text) Constructor that defaults the character set to "utf-8".TextStreamResponse
(String contentType, String charset, String text) Constructor allowing the content type and character set to the specified.TextStreamResponse
(ContentType contentType, String text) -
Method Summary
Modifier and TypeMethodDescriptionReturns the content type to be reported to the client.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.void
prepareResponse
(Response response) Does nothing; subclasses may override.
-
Constructor Details
-
TextStreamResponse
Constructor that defaults the character set to "utf-8". -
TextStreamResponse
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:
-
TextStreamResponse
-
-
Method Details
-
getContentType
Description copied from interface:StreamResponse
Returns the content type to be reported to the client.- Specified by:
getContentType
in interfaceStreamResponse
-
getStream
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:
getStream
in interfaceStreamResponse
- Returns:
- the text as a byte array stram
- Throws:
IOException
-
prepareResponse
Does nothing; subclasses may override.- Specified by:
prepareResponse
in interfaceStreamResponse
- Parameters:
response
- Response that will be sent.
-