Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 17238 invoked from network); 15 Feb 2006 13:33:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Feb 2006 13:33:36 -0000 Received: (qmail 68871 invoked by uid 500); 15 Feb 2006 13:33:25 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 68740 invoked by uid 500); 15 Feb 2006 13:33:24 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 68727 invoked by uid 99); 15 Feb 2006 13:33:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 05:33:24 -0800 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=HTML_MESSAGE,INFO_TLD,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of dattaprasad.kamat@gmail.com designates 64.233.184.202 as permitted sender) Received: from [64.233.184.202] (HELO wproxy.gmail.com) (64.233.184.202) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 05:33:23 -0800 Received: by wproxy.gmail.com with SMTP id i20so548138wra for ; Wed, 15 Feb 2006 05:33:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=DarEwjTYKuGrZRQl0LJzXtzafu0VBmOSpCzR/M9Z5hknBsm98IJ8Izj09rgwZ+v8D6V1XQ4geXr9Cy02ngh4186pVeZGHYcHO22WqsRxb84YSXubvt3Zhx5jQow6vceH5ZvrSfY6QzJRCz5PgGyPt2OiRJiisTv/WFem5XWdGEM= Received: by 10.54.96.9 with SMTP id t9mr3880241wrb; Wed, 15 Feb 2006 05:33:00 -0800 (PST) Received: by 10.54.111.8 with HTTP; Wed, 15 Feb 2006 05:33:00 -0800 (PST) Message-ID: <3b6807e80602150533l3866099dxed8e2b75125ef2d2@mail.gmail.com> Date: Wed, 15 Feb 2006 19:03:00 +0530 From: Dattaprasad Kamat To: users@httpd.apache.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11412_25633958.1140010380826" X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] "java.lang.OutOfMemoryException : Java heap space" for download due to ExtensionsFilter X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_11412_25633958.1140010380826 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi All, I need help ... I'm using the Tomahawk library in our project. In web.xml I have an entry as follows ..., -------------------- MyFacesExtensionsFilter org.apache.myfaces.component.html.util.ExtensionsFilter MyFacesExtensionsFilter Faces Servlet MyFacesExtensionsFilter /faces/myFacesExtensionResource/* MyFacesExtensionsFilter *.jsf MyFacesExtensionsFilter *.jsp ------------------------- In the project I have download code as follows : private void copyFileToResponse(HttpServletResponse response, FileInputStream fileIn) throws IOException { int BUFF_SIZE=3D4096; byte[] buffer =3D new byte[BUFF_SIZE]; ServletOutputStream responseOutStream =3D response.getOutputStream(); BufferedInputStream buf =3D new BufferedInputStream(fileIn); int n =3D 0; int count =3D 0; while((n =3D buf.read(buffer)) !=3D -1) { // responseOutStream.write(buffer); LOGGER.info("while loop : before write to Buffer and count =3D= > " + count); responseOutStream.write(buffer,0,n); count +=3D n; LOGGER.info("while loop : copyFileToResponse flush"); responseOutStream.flush(); LOGGER.info("while loop : copyFileToResponse flushBuffer"); LOGGER.info("while loop : after buffer read"); } LOGGER.info("after while loop : before flushbuffer"); buf.close(); LOGGER.info("after while loop : before flushbuffer"); response.flushBuffer(); responseOutStream.close(); LOGGER.info("after while loop : after flushbuffer"); } My problem is as follows, If I have the mentioned entries in the web xml and I'm trying to downlaod = > 100 MB file, the above code, throws "java.lang.OutOfMemoryException : Java heap space" org.apache.catalina.connector.CoyoteOutputStream. But it works fine if I remove the entries from the web.xml file. I have debuuged and found that if I keep above "MyFacesExtensionsFilter" related entries in web.xml, the response is instantiated from org.apache.myfaces.component.html.util.ExtensionsResponseWrapper, in which case flush() doesn't work and causes the "java.lang.OutOfMemoryException : Java heap space" error. If I remove the MyFacesExtensionsFilter related entries, the response gets instantiated by "org.apache.catalina.connector.CoyoteOutputStream", in which case flush works fine. Can anyone tell me how to avoid this situation by still maintaing the "MyFacesExtensionsFilter" related entries in the web.xml. Regards, Datta ------=_Part_11412_25633958.1140010380826 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi All,
  
 I need help ...
 
  I'm using the Tomahawk library in our project. In web.xml I have an= entry as follows ...,
 --------------------
   =   <filter>
   <filter-name>MyFacesExtens= ionsFilter</filter-name>
   <filter-class>org.apache.myfaces.component.html= .util.ExtensionsFilter</filter-class>
     <= ;/filter>
    
    
&= nbsp;     <filter-mapping>
   &= nbsp;      <filter-name>MyFacesExtensionsFilter&l= t;/filter-name>
          <!-- servlet-name = must match the name of your javax.faces.webapp.FacesServlet entry -->          <servlet-name>Face= s Servlet</servlet-name>
      </filte= r-mapping>
      
      <!-- extension mapping for serving page-i= ndependent resources (javascript, stylesheets, images, etc.)  -->      <filter-mapping>
  &nbs= p;       <filter-name>MyFacesExtensionsFilte= r</filter-name>
          <url-pattern>/f= aces/myFacesExtensionResource/*</url-pattern>
   &n= bsp;  </filter-mapping>
      &= nbsp;  <filter-mapping>
      &= nbsp;    <filter-name>MyFacesExtensionsFilter</filt= er-name>
           <url-pa= ttern>*.jsf</url-pattern>
       = </filter-mapping> 
       =   <filter-mapping>
       =     <filter-name>MyFacesExtensionsFilter</filter-na= me>
           <= url-pattern>*.jsp</url-pattern>
   </filter-mapping> 
  ------------------= -------
 
 
In the project I have download code as follows :
 
 pr= ivate void copyFileToResponse(HttpServletResponse response, FileInputStream= fileIn) throws IOException {
       =   int BUFF_SIZE=3D4096;
   byte[] buffer =3D new byt= e[BUFF_SIZE];
   ServletOutputStream responseOutStream =3D response.ge= tOutputStream();
         Buffer= edInputStream buf =3D new BufferedInputStream(fileIn);
   = ;      int n =3D 0;
    &nb= sp;    int count =3D 0;
  
  while= ((n =3D buf.read (buffer)) !=3D -1) {
 
       = ;     
 //     &= nbsp;      responseOutStream.write(buffer);
&nb= sp;            LOGGE= R.info("while loop : before write to Buffer and count =3D> " += count);
          &nb= sp;  responseOutStream.write (buffer,0,n);
         &nbs= p;   count +=3D n;
       &= nbsp;  
         = ;    LOGGER.info("while loop : copyFileToResponse flush= ");
          &nb= sp;  responseOutStream.flush();
      = ;       LOGGER.info("while loop : copyFi= leToResponse flushBuffer");
            = ; LOGGER.info("while loop : after buffer read");
  &= nbsp;      }
     &nbs= p;   LOGGER.info("after while loop : before flushbuffer"= ;);
         buf.close();
&nb= sp;        LOGGER.info("after while= loop : before flushbuffer");
         response.flushBuffer()= ;
         responseOutStream.clo= se();
         LOGGER.info("= ;after while loop : after flushbuffer");
 }
 
 = ;
 My problem is as follows,
 
 
 If I hav= e the mentioned entries in the web xml and I'm trying to downlaod > 100 = MB file,=20
 
 the above code, throws
 
 "java.l= ang.OutOfMemoryException : Java heap space"
 
 org.ap= ache.catalina.connector.CoyoteOutputStream.
 
 But it works= fine if I remove the entries from the=20 web.xml file.
 
 I have debuuged and found that if I keep a= bove "MyFacesExtensionsFilter" related entries in web.xml, the re= sponse is instantiated from org.apache.myfaces.component.html.util.Extensio= nsResponseWrapper , in which case flush() doesn't work and causes the "java.lang.OutOfMe= moryException : Java heap space" error.
 
 If I remove= the MyFacesExtensionsFilter related entries, the response gets instantiate= d by
 "org.apache.catalina.connector.CoyoteOutputStream", in whic= h case flush works fine.
  
 
 Can anyone tell= me how to avoid this situation by still maintaing the "MyFacesExtensi= onsFilter" related entries in the=20 web.xml.
 
Regards,
Datta
 
------=_Part_11412_25633958.1140010380826--