You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Tomas Havelka (JIRA)" <de...@myfaces.apache.org> on 2006/09/01 10:20:22 UTC

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

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

        

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

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOMAHAWK-648?page=comments#action_12435684 ] 
            
Martin Marinschek commented on TOMAHAWK-648:
--------------------------------------------

I just committed your fix - can anyone test if this really helps?

regards,

Martin

> 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

        

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

Posted by "Robert Oschwald (JIRA)" <de...@myfaces.apache.org>.
    [ 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.


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

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ 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