You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dattaprasad Kamat <da...@gmail.com> on 2006/02/15 14:33:00 UTC
[users@httpd] "java.lang.OutOfMemoryException : Java heap space" for download due to ExtensionsFilter
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>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your
javax.faces.webapp.FacesServlet entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- extension mapping for serving page-independent resources
(javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
-------------------------
In the project I have download code as follows :
private void copyFileToResponse(HttpServletResponse response,
FileInputStream fileIn) throws IOException {
int BUFF_SIZE=4096;
byte[] buffer = new byte[BUFF_SIZE];
ServletOutputStream responseOutStream = response.getOutputStream();
BufferedInputStream buf = new BufferedInputStream(fileIn);
int n = 0;
int count = 0;
while((n = buf.read(buffer)) != -1) {
// responseOutStream.write(buffer);
LOGGER.info("while loop : before write to Buffer and count => "
+ count);
responseOutStream.write(buffer,0,n);
count += 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
Re: [users@httpd] "java.lang.OutOfMemoryException : Java heap space" for download due to ExtensionsFilter
Posted by Joshua Slive <jo...@slive.ca>.
On 2/15/06, Dattaprasad Kamat <da...@gmail.com> wrote:
> 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>MyFacesExtensionsFilter</filter-name>
Sounds liek you found the wrong mailing list. We discuss the Apache
HTTP Server here. Perhaps you are looking for:
http://myfaces.apache.org/
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org