dev@glassfish.java.net

Seeking Review from Kin-Man Chung: Change to JSTL impl

From: Ed Burns <edburns_at_yahoo.com>
Date: Wed, 9 Nov 2005 12:44:44 -0800 (PST)

Part of the fix for this bug:

https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=193

is in the JSTL implementation.

Here is a patch from Kin-Man that I have slightly
modified to take it the last mile.

Index: ImportSupport.java
===================================================================
RCS file:
/cvs/glassfish/appserv-jstl/src/org/apache/taglibs/standard/tag/common/core/ImportSupport.java,v
retrieving revision 1.2
diff -r1.2 ImportSupport.java
23a24
> import java.io.Writer;
429a431,432
>
> private HttpServletResponse response;
436a440
> this.response = response;
440c444
< public PrintWriter getWriter() {
---
>        public PrintWriter getWriter() throws
IOException {
445c449
< 	    return new PrintWriter(sw);
---
> 	    return new PrintWriterWrapper(sw,
response.getWriter());
493a498,518
> 
>     private static class PrintWriterWrapper extends
PrintWriter {
> 
>         private StringWriter out;
>         private Writer parentWriter;
> 
>         public PrintWriterWrapper(StringWriter out,
Writer parentWriter) {
>             super(out);
>             this.out = out;
>             this.parentWriter = parentWriter;
>         }
> 
>         public void flush() {
>             try {
>                 parentWriter.write(out.toString());
>                 StringBuffer sb = out.getBuffer();
>                 sb.delete(0, sb.length());
>             } catch (IOException ex) {
>             }
>         }
>      }
		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com