nbubna      2003/10/06 17:19:04

  Modified:    src/java/org/apache/velocity/tools/view/servlet
                        VelocityViewServlet.java
  Log:
  per bug 23621 (Matthew Payne) - use response.getWriter() instead of 
response.getOutputStream()
  
  Revision  Changes    Path
  1.16      +6 -6      
jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java
  
  Index: VelocityViewServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity-tools/src/java/org/apache/velocity/tools/view/servlet/VelocityViewServlet.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- VelocityViewServlet.java  2 Oct 2003 00:13:11 -0000       1.15
  +++ VelocityViewServlet.java  7 Oct 2003 00:19:04 -0000       1.16
  @@ -585,7 +585,7 @@
                  MethodInvocationException, IOException, 
                  UnsupportedEncodingException, Exception
       {
  -        ServletOutputStream output = response.getOutputStream();
  +        PrintWriter pw = response.getWriter();
           VelocityWriter vw = null;
           
           try
  @@ -594,11 +594,11 @@
               
               if (vw == null)
               {
  -                vw = new VelocityWriter(new OutputStreamWriter(output, encoding), 
4*1024, true);
  +                vw = new VelocityWriter(pw, 4*1024, true);
               }
               else
               {
  -                vw.recycle(new OutputStreamWriter(output, encoding));
  +                vw.recycle(pw);
               }
              
               template.merge(context, vw);
  @@ -614,7 +614,7 @@
                       // nicely with others.
                       vw.flush();
                       /* This hack sets the VelocityWriter's internal ref to the 
  -                     * OutputStreamWriter to null to keep memory free while
  +                     * PrintWriter to null to keep memory free while
                        * the writer is pooled. See bug report #18951 */
                       vw.recycle(null);
                       writerPool.put(vw);
  @@ -664,7 +664,7 @@
               html.append("</pre>");
               html.append("</body>");
               html.append("</html>");
  -            response.getOutputStream().print(html.toString());
  +            response.getWriter().print(html.toString());
           }
           catch (Exception e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to