The moose likes Struts and the fly likes Corrupt file download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Corrupt file download" Watch "Corrupt file download" New topic

Corrupt file download

Nick Sher
Ranch Hand

Joined: Nov 10, 2008
Posts: 78

I am trying to download a file using Struts 2 but the downloaded XML file is corrupt. It works if the xml file has around 60 lines else the content is ignored. I am not an IO expert but kindly correctly me if I need to fix anything here. Can someone please help me? Here is what I am trying to do.

The Action class

The service class:

The struts.xml settings:

Nick Sher
Ranch Hand

Joined: Nov 10, 2008
Posts: 78

The fix is to use:
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

And specifically in regard to your post, I think you will find that the utility you mention doesn't make the mistake of assuming the "available()" method will always return the length of the response body.
Don't get me started about those stupid light bulbs.
subject: Corrupt file download
Similar Threads
Data loss converting StringBuilder to byte[]?
Getting Onle One File when getting reponse through ksoap2 web service.
What 's wrong with it?? Thanx!
Cannot Figure Out This Syntax Error
403 Error while download a file using java from Solaris OS