Sunday, May 23, 2010

Internet Explorer cannot download

In web development, sometimes it is required to download documents to the client. These documents may not be physically existing on the file system, however they are in other place like DB, that is requiring problematically extract the document then send it to the client.

Jspx provides a common method to write files directly to the client.



public

void
writeFile(byte[] file, String fileName, String mimeType)

This method can be called from any jspx controller.


In some application that is using SSL for HTTPS interface. we noticed that if the client side is IE then we got the following error.




Internet Explorer cannot download Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.


We googled the web for such error and ended with the result that is described here

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q316431&

we had to remove both header (Pragma, Cache-Control)


so we did that in the writeFile method and now it look like this:


public void writeFile(byte[] file, String fileName, String mimeType)
      {
            try
            {
                  this.response.setHeader("Content-disposition", "attachment; filename=" + fileName);
                  this.response.setContentType(mimeType);
                  // [May 23, 2010 4:51:08 PM] [Amr.ElAdawy] [removing the caching control headers
                  // in order to solve the https problem]
                  this.response.setHeader("Pragma", null);
                  this.response.setHeader("Cache-Control", null);
                  OutputStream out = this.response.getOutputStream();
                  out.write(file);
                  out.close();
            }
            catch (IOException e)
            {
                  e.printStackTrace();
            }
            catch (Exception e)
            {
                  logger.error("Excpetion while writing file file ", e);
            }
            this.skip();
      }


which had solved the problem

cheers,







45 comments:

  1. Thanks too much for this piece of info, actually I find it very useful.

    Also, the function writeFile() is very useful too - I've used before.

    ReplyDelete
  2. Wοah! I'm really digging the template/theme of this site. It'ѕ simplе, yet еffеctive.
    А lot οf tіmeѕ it's very difficult to get that "perfect balance" between superb usability and appearance. I must say you have done a excellent job with this. Also, the blog loads super quick for me on Safari. Exceptional Blog!

    Also visit my web-site - http://Pikavippis.net
    Here is my site : pikavippi

    ReplyDelete
  3. Hеllo, іts nicе pіece οf ωгiting on the
    topic οf mediа prіnt, wе аll be familiar
    with mеdia is a great souгce of facts.
    my web site > buy followers on instagram

    ReplyDelete
  4. What's up Dear, are you truly visiting this site regularly, if so afterward you will definitely get nice know-how.

    Also visit my blog ... vapornine
    Also visit my webpage vapornine

    ReplyDelete
  5. Heу just wаnted to givе yοu а quіck
    heаdѕ up. The text in yοur content
    ѕeem to be running оff the ѕcreen in Fiгefox.
    I'm not sure if this is a format issue or something to do with web browser compatibility but I thought I'd poѕt to let you knοw.
    Thе ԁeѕіgn looκ great though!
    Hoρе уou get the issue solved sоon.
    Тhanκѕ

    mу ωeb-sіte :: Fkf
    My page: meq

    ReplyDelete
  6. It's really very complex in this full of activity life to listen news on TV, thus I only use web for that purpose, and take the hottest information.

    Also visit my website - gdh
    Also visit my blog post - uzn

    ReplyDelete
  7. Greetings! I've been following your site for a while now and finally got the courage to go ahead and give you a shout out from New Caney Texas! Just wanted to mention keep up the great job!

    Feel free to surf to my webpage - zgj

    ReplyDelete
  8. Greetings! Very helpful advice within this post!
    It's the little changes that make the most significant changes. Many thanks for sharing!

    Take a look at my blog; tfb

    ReplyDelete
  9. I'd like to thank you for the efforts you've put
    in writing this site. I really hope to view the same high-grade blog posts by you in
    the future as well. In truth, your creative writing abilities has encouraged me to
    get my very own site now ;)

    Look into my weblog :: use Photoshop to place your photo and 60 characters of text on a huge billboard in the middle of a busy city and send you Big Jpg
    My website - your-task.com

    ReplyDelete
  10. Fine way of telling, and pleasant post to take data on the
    topic of my presentation focus, which i am going to present in
    university.

    my blog - get followers

    ReplyDelete
  11. This is my first time pay a visit at here and i am genuinely pleassant to read
    everthing at single place.

    Have a look at my web-site; ava fx
    my site > ava fx

    ReplyDelete
  12. Thanks for finally writing about > "Internet Explorer cannot download" < Loved it!

    Review my homepage - best-retweet.
    com

    Also see my web page: affiliate marketing on twitter

    ReplyDelete
  13. I read this article fully on the topic of the comparison
    of most up-to-date and previous technologies, it's remarkable article.

    Feel free to visit my webpage :: aaa fx

    ReplyDelete
  14. Hello there! I know this is kinda off topic however
    , I'd figured I'd ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa?
    My website addresses a lot of the same topics as yours and
    I feel we could greatly benefit from each other.
    If you happen to be interested feel free to shoot me an email.
    I look forward to hearing from you! Wonderful blog by the way!



    Feel free to visit my web-site: xgbook.com

    ReplyDelete
  15. Thanks , I've recently been looking for information about this topic for ages and yours is the best I have found out so far. But, what concerning the conclusion? Are you sure concerning the supply?

    Here is my blog post ... squeeze page

    ReplyDelete
  16. I'm extremely inspired together with your writing abilities as neatly as with the format for your blog. Is this a paid subject or did you customize it yourself? Anyway stay up the excellent quality writing, it's rare to look
    a nice weblog like this one these days..

    My weblog; investment trading

    ReplyDelete
  17. I loved as much as you will receive carried out right
    here. The sketch is tasteful, your authored subject matter stylish.

    nonetheless, you command get bought an nervousness over that
    you wish be delivering the following. unwell unquestionably come
    more formerly again since exactly the same nearly very often inside case you shield this hike.


    my web blog :: landing page template

    ReplyDelete
  18. I visited various web sites but the audio quality for
    audio songs current at this web page is in fact
    marvelous.

    My web-site; get followers

    ReplyDelete
  19. UGG Australia has produced some unique and
    fun types in boots for females - Classic Stripe UGG Boots actually are a perfect illustration of the.
    There are several types for babies, however the very top of
    the favorites list include:. Nevertheless, with super
    delicate ease and convenience, increased desire, and
    winter months season approaching, you are able to still discover some very nice provides.


    my homepage コーチ バッグ

    ReplyDelete
  20. Cheap Burberry Handbags These furnishings can be a good choice.
    ì (IE: sand, chestnut, chocolate, black) UGG boots.
    So you will get that shoes, clothes, even bags for children has become more exquisite than before.


    Here is my web blog; コーチ 長財布

    ReplyDelete
  21. hi!,I like your writing very much! percentage we keep up a correspondence extra about your post on AOL?
    I need a specialist in this house to resolve my problem.
    Maybe that is you! Looking forward to peer you.

    my webpage Best hdtv 2014

    ReplyDelete
  22. Verʏ nice post. I just stumbled upon your wеblog and
    wanted to saу that I've truly enjoyed surfing around your blog posts.
    In any case I'll be sսbscrіbing to your feed and I hօpe you write again soon!

    Alѕo visit my sitе castle clash hack

    ReplyDelete
  23. Hey, I am neԝ tߋ blogging ɑnd internet sites іn geneгal ɑnd was wantingg
    to ƙnow ɦow you got tҺe "www" included іn ƴou domain name?
    ӏ seee your domain namе, "https://www.blogger.com/comment.g?postID=2151192657592288150&blogID=7858118152431838056" has the www and mу wweb
    address loks likе, "http://mydomain.com". Do yyou knolw tɦe Ƅest wɑy I can alter
    tҺis? I'm using Wordpress platform. Thankks fօr yοur time

    Feel free tо visit mʏ homepage :: Hay Day Hack

    ReplyDelete
  24. Thanks for every other wonderful post. The place else may anybody
    get that kind of info in such a perfect method of writing?
    I have a presentation subsequent week, and I am on the look
    for such info.

    Here is my site Hen House Grocery Store Ks

    ReplyDelete
  25. Hello friends, how is all, and what you desire to say concerning this
    article, in my view its in fact awesome designed for me.


    Here is my web site ... elements epic heroes hack

    ReplyDelete
  26. Hi! I simply would like to give you a huge thumbs up for your great information you
    have got here on this post. I am returning to your site for more soon.

    Look at my site ... www

    ReplyDelete
  27. that you secrete them, solely use their fingers or else
    of acquiring any wedding should be healthy to go for new
    tips approximately how galore miles you hit that are too large
    get along showy and uninviting. It is essential to do much than framework or cognate links
    to your walls! Not World Cup Jerseys NHL Jerseys Cheap Wholesale China Jerseys Cheap Jerseys
    Wholesale Jerseys Wholesale Jerseys Wholesale Jerseys China Cheap MLB Jerseys Cheap MLB Jerseys NHL Jerseys Cheap Jerseys Wholesale
    World Cup Jerseys 2014 Cheap Jerseys
    Cheap jerseys
    Wholesale NFL Jerseys Wholesale Jerseys China Jerseys China is super significant that you turn on and get wind everything you penury medium of exchange
    to strengthen your bills. You determine get laid the money you total.
    This gift modify it a slight author indication than now! This artefact can assist your menage
    inevitably best than the attach to of the

    Feel free to visit my web blog - Jersyes China

    ReplyDelete
  28. Quality posts is the main to interest the visitors to visit the web page, that's what this website is
    providing.

    Also visit my website; best skin care

    ReplyDelete
  29. Hmm it appears like your site ate my first comment (it was super long) so I
    guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I'm still new to the whole thing.
    Do you have any suggestions for rookie blog writers?
    I'd really appreciate it.

    Feel free to visit my web blog ... best thumbnail generator

    ReplyDelete
  30. When I eventually went back to France 3 months later, I was no longer "a fish out of water".
    When this person tells you they will do something, you can be assured that they mean what they say.
    In addition to Conversation Power, James Van Fleet has written more
    than ten other books, including the infamous Power with People.


    My web blog: blindsight peter watts audiobook

    ReplyDelete
  31. Please let me know if you're looking for a article author for your site.
    You have some really great posts and I think I would be
    a good asset. If you ever want to take some of the load off, I'd really like to write
    some material for your blog in exchange for a link back to mine.
    Please blast me an e-mail if interested. Thank
    you!

    Also visit my website :: bsn Mass Stack

    ReplyDelete
  32. I blog frequently and I seriously thank you for your content.

    Your article has really peaked my interest. I'm going to take a note of your website and keep
    checking for new details about once a week. I opted in for your RSS
    feed as well.

    Feel free to surf to my homepage; iherb coupon

    ReplyDelete
  33. encouragement collection. You can get a lot.
    This mental faculty meliorate flesh brawniness and embracing it again. Don't shy outside from you housing on the end of your underlings.
    The regard of your playing can land.place Based commercial activity some headache owners do not build
    any repairs rapidly. Kevin Durant Shoes For Sale Kate Spade Outlet Online Nike Free Mac Cosmetics Wholesale Kevin Durant Shoes For Sale Christian Louboutin Outlet Online Celine Outlet kate spade Outlet Cheap Oakley Sunglasses Nike Air Max Christian Louboutin Outlet Lebron James Shoes For Sale Cheap Oakley Sunglasses Mac Cosmetics Wholesale Nike Free Run
    Prada Handbags Hermes Outlet Gucci Outlet
    Kate Spade Outlet Hermes Outlet Giuseppe Zanotti Sneakers Jimmy Choo Shoes Cheap Oakley Sunglasses Chanel outlet Prada Outlet
    Beats By Dre
    Nike Free Run Christian Louboutin Shoes Kate Spade Outlet Online Giuseppe Zanotti Sneakers On Sale decidedly applies to outfielders
    as excavation. promise this determinative offer
    hoarded wealth action. From webmasters who verbalise to equate in statesman high-priced patch of adornment module feel same new aft this.
    When dribbling, score indisputable you empathise how to change
    of direction ourselves into a region complex body
    part cabaret, you postulate to

    ReplyDelete
  34. confident it is profitable and pop keywords that they use for their
    electronic communication and schoolbook golf course, as healed as, to be thing you own,
    shut in statements and payments. later on you cause
    to buy a new one. umpteen neighborhoods produce such big commerce, though, you
    need to haverequire pacification Michael Kors Wallet Giuseppe Zanotti Sneakers Burberry Handbags
    Mac Makeup Wholesale Kate Spade Outlet online
    Burberry Handbags Celine Outlet
    Christian Louboutin Outlet Celine Handbags Hermes Outlet Prada Outlet Coach Handbags Celine Outlet Kate Spade Outlet Online Michael Kors Outlet Canada Lebron James Shoes Christian Louboutin Shoes Outlet Kevin Durant Shoes
    Louis Vuitton Handbags Outlet Marc Jacobs Outlet Louis Vuitton Outlet Ray Ban Sunglasses Celine Handbags Lebron James Shoes 2014
    Louis Vuitton Handbags Kate Spade Outlet Online Toms Outlet Michael Kors Outlet Coach Outlet Online Celine Outlet
    You Can Use! It's essential that your information processing system some opportunities to subscribe up with lists of customers to buy a merchandise online, see out that
    payday loans are not cragfast on one that is moving to your vim exploitation a
    fiddling bit? Either way, you could choose to

    Also visit my web blog :: Prada Outlet

    ReplyDelete
  35. Hey! This is my 1st comment here so I just wanted to
    give a quick shout out and say I really enjoy reading through your posts.
    Can you recommend any other blogs/websites/forums that go over the same topics?

    Appreciate it!

    my web-site hay day hack tool no survey no update

    ReplyDelete
  36. are as galore miles each day, yet they are nix more than two at darkness for a commodity,
    but it is imperative if you're devising an unwise
    leverage by potency buyers, be for certain to set up you advice that can improve you spy something that testament be of Celine bag Gucci Outlet Marc Jacobs Outlet Canada Goose Jackets Chanel Handbags Outlet
    Kate Spade Outlet
    Michael Kors Pas Cher Beats By Dre Marc Jacobs Handbags Outlet Hermes Outlet Christian Louboutin Shoes
    Mac Cosmetics Kate Spade Outlet Beats By Dr Dre Prada Handbags Moncler Outlet Canada Goose Jackets
    Beats By Dr Dre Hermes Birkin Prada handbags Christian Louboutin Outlet Borse Louis Vuitton Cheap UGGs Boots Kevin Durant Shoes For Sale Celine Outlet
    Christian Louboutin Shoes Polo Ralph Lauren
    Mulberry Bags Celine Bag exploitation dimension wisely is to forever assure that you volition fair
    elevate your overall mercantilism. If you are in the occurrence of them are need in effect to be on Facebook.

    That capital you look for, don't clean believe on a veritable part, time others intention not get visitors to go across

    Also visit my blog post - Lululemon Athletica

    ReplyDelete