• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Downloading file - Problem in struts?

 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to download one file(test.tar). I use struts framework. I wrote struts action class to read the file and write the contents into response outputstream then close and return null. With this I get download box displaying forever saying 'Internet explorer was not able to open this internet site. The request site is either unavailable or cannot be found.'
But if I keep the same code whatever is there in exectue method of action class in servlet doGet method, it works fine. File is getting downloaded to Browser. whats wrong in using struts framewok?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've written quite a few downloads using the method you describe in Action classes and they work fine. There is a working example of this type of download in the struts-examples.war file that comes with the Struts download. Check out the org.apache.struts.webapp.exercise.ImageAction class. You may be able to see something they're doing that you're not.

If you're still unable to get it working, post the code in your Action class and we'll help you debug it.
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,
Thanks for your reply. It worked finally. This happened because I set one of the response header 'Cache-Control' as 'no-cache' and 'Expires' as zero.
That caused the problem. I did not notice this code as this was getting executed in custom preprocessor class (overriding the method processNoCache() in that).
But surprisingly this worked in websphere 4 server but not in websphere 6 server. Finall i removed that code of setting response headers and it worked. I'm not sure why it was working in webshere 4 server.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic