You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Robert Oschwald (JIRA)" <de...@myfaces.apache.org> on 2007/05/10 10:00:32 UTC

[jira] Commented: (TOMAHAWK-648) Buffer component doesn't support any apecial characters

    [ https://issues.apache.org/jira/browse/TOMAHAWK-648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494661 ] 

Robert Oschwald commented on TOMAHAWK-648:
------------------------------------------

This issue is still present in 1.1.5. 
We've worked around it by using Tom's fixed version in an own component for now.
The fix works as expected.

Can someone please assign the issue to 1.1.5, too?

Robert
 

> Buffer component doesn't support any apecial characters
> -------------------------------------------------------
>
>                 Key: TOMAHAWK-648
>                 URL: https://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.
-
You can reply to this email to add a comment to the issue online.