Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-648

Buffer component doesn't support any apecial characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.3, 1.1.5
    • None
    • Buffer
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            havis Tomas Havelka
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: