Radim wrote:
Something like (off the top of my head):
BufferedInputStream is = new BufferedInputStream(new FileInputStream(new File(filepath))); Although I haven't looked at the code of StreamingResolution I imagine just by its name that it will chunk read and send the contents of the input stream otherwise it wouldn't be called StreamingResolution. Buffering is probably your problem or you are hitting this bug (which buffering might fix):

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6478546

I tried the version with BufferedInputStream and it looks same.
Ok. But keep in mind whether or not this fixes the problem or not you should ALWAYS use buffering. And you don't have to take my word for it just run a timed test yourself. Again I know this didn't resolve this issue but good to keep your code at its best... .

The server just send first 70 - 90 MB of file and then throws java.lang.OutOfMemoryError: Java heap space.
What Java JDK version are using?

What version of GlassFish?

I assume you are using the -server option?

BTW what are your JVM settings / options? e.g. your min heap, max heap, etc....

I'm not sure, but in Glassfish is: JVM Settings -> JVM Options -> "-Xmx512m".
Try setting as well:   -Xms512m
Again not sure this will help but there have been bugs in the past with heaps re-sizing.

Yes, I probably will do it this way. But I need some kind of security. Some files can be available to specific users. Maybe randomly generated names of files and periodically renaming will do the thing.
Not sure if this will work but what about using a Servlet Filter for the security piece and once the user is authenticated or whatever forward the request to the real resource on the back end (that way the user never sees the actual URL).

Out of curiosity what are you streaming that is 70-90MB. I frequently

I tried this with 200 MB large file. But I need to send even larger files. 2 - 
3 GB.
Wow. Okay that appears a little nuts to me to try to stream 2-3GB files through a web browser. But if you had to I would eliminate as many components in the stack between your App and the web browser i.e. don't stream through Stripes or any framework for that matter. And keep in mind that HTTP is not a very efficient protocol for downloads vs. FTP / SFTP i.e. the downloads will take MUCH longer with HTTP and are more likely to drop not to mention your stuffing this through your application server. A simple FTP / SFTP service is much more streamlined and efficient and IIRC is much more capable of resuming a download.

If you had only a handful of clients to deal with then I would consider the FTP / SFTP option... just set up an account for each of your clients.

Another thing you may want to look out for is a some sort of downloader product that allows you to chop up the file into smaller chunks like 500MB or whatever and downloads and assembles them... or even one that can download the entire thing but resumes... I don't know of any particular products but I imagine they exist as you are probably not the 1st person to want to download such large files. The security part would still be an issue and again I would suggest using FTP / SFTP.

Lastly, you could build your own downloader client that ensures appropriate authentication and downloads from a back-end FTP / SFTP server. IIRC Documentum did just this about 5 years ago - using some Applet IIRC - but you could build a thin fat client... .

In any event, I don't think this issue is a Stripes issue anymore... and the appropriate solution depends highly on your requirements.

--Nikolaos




Thanks,
Radim

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Nikolaos Giannopoulos
Director, BrightMinds Software Inc.
e. nikol...@brightminds.org
w. www.brightminds.org
t. 1.613.822.1700
c. 1.613.797.0036
f. 1.613.822.1915

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to