• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Corrupt Error on ZIP File Download Using Streams in Java

 
Sankar Nadar
Greenhorn
Posts: 3
Chrome Safari Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
The problem is when i run the below code works fine. But the ZIP file downloaded is corrupt.
Is there any possibilities? any suggestion please.

Actions Done From Side:
1. Checks the downloaded files size.(it same as the orginal file).
2.checks the orginal file(its not corrupted).

Things i noticed :

The below page is the web application in LINUX server and i try to run the same code in windows based application server.
Its works fine in windows and zip file opens properly.
Is there anything related to OS means. How can i resolve that. ?
Is there related to version problem. (MY linux server JDK version is 1.6 and My web application JDK version is 1.5).Means Please help me how to resolve it.?







Please Help me...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not be doing this in a JSP. Please read this article to find out why.
 
Stefan Evans
Bartender
Posts: 1782
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The file will be being corrupted by the JSP printing emitting white space and newlines.
Copying the code into a servlet (it's all java code anyway) and invoking it like that should work
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is exactly what the article points out. I hope the OP read it.
 
Sankar Nadar
Greenhorn
Posts: 3
Chrome Safari Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all... I understood the logic and i start reading all the basic things about the JSP..
The article was nice and easy to understand. Surely i go with the option of servlet for binary data's...

But still i cannt understood one thing.
How my code works in windows based application ?. Bt not in linux..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Different implementations. You were just lucky on Windows.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic