You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org> on 2006/09/19 08:12:25 UTC
[jira] Commented: (TOMAHAWK-648) Buffer component doesn't support
any apecial characters
[ http://issues.apache.org/jira/browse/TOMAHAWK-648?page=comments#action_12435679 ]
Martin Marinschek commented on TOMAHAWK-648:
--------------------------------------------
Related issue: TOMAHAWK-45
> Buffer component doesn't support any apecial characters
> -------------------------------------------------------
>
> Key: TOMAHAWK-648
> URL: http://issues.apache.org/jira/browse/TOMAHAWK-648
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Components: Buffer
> Affects Versions: 1.1.3
> Reporter: Tomas Havelka
>
> Buffer component doesn't support any special characters such as national characters. HtmlBufferResponseWriterWrapper causes this problem. Buffer temporary writer opened doesn't define character encoding at all.
> Solution: rewrite HtmlBufferResponseWriterWrapper like this:
> public class HtmlBufferResponseWriterWrapper extends HtmlResponseWriterImpl
> {
> /** string writer to use to write content */
> private StringWriter stringWriter;
> /** print writer to wrap string writer */
> private PrintWriter writer;
> /** original response writer*/
> private ResponseWriter initialWriter;
> /**
> * Returns original faces response writer instance.
> * @return
> */
> public ResponseWriter getInitialWriter()
> {
> return initialWriter;
> }
> /**
> * Creates instance of HtmlBufferResponseWriterWrapper.
> *
> * @param initialWriter initial faces response writer instance
> * @return
> */
> public static HtmlBufferResponseWriterWrapper getInstance(ResponseWriter initialWriter)
> {
> StringWriter stringWriter = new StringWriter();
> PrintWriter instanceWriter = new PrintWriter(stringWriter, true);
> return new HtmlBufferResponseWriterWrapper(initialWriter, stringWriter, instanceWriter);
> }
> /**
> * Constructor.
> *
> * @param initialWriter original faces response writer
> * @param stringWriter string writer that holds content
> * @param writer writer that wrapes string writer
> */
> private HtmlBufferResponseWriterWrapper(ResponseWriter initialWriter, StringWriter stringWriter, PrintWriter writer)
> {
> super(writer, (initialWriter == null) ? null : initialWriter.getContentType(),
> (initialWriter == null) ? null : initialWriter.getCharacterEncoding());
> this.stringWriter = stringWriter;
> this.writer = writer;
> this.initialWriter = initialWriter;
> }
> /**
> * Returns wrapper content as string.
> * @return
> */
> public String toString()
> {
> writer.flush();
> writer.close();
> return stringWriter.toString();
> }
> }
> Tom
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira