Aravind wrote:

> i have written a chat application which also provides save option for the
> users to save the chat contents while they logout.
> (from chat servlet, i am writing the contants into file)
>
> now the problem is, when i click the save link, the file contents are
> displayed into browser screen.  but im expecting the browser to ask for
> "Download" option.
>
> i understood that all text files will be directly displayed in browser
> window. so i modified my program to have Streams instead of Writer so that
> it will write as bytes. but this  doesnt works
>
> also i tried including a hexadecimal info at the start of the file but still
> it is not working
>
> please help me to output a non-text file......


    response.setContentType("application/xxx-very-strange-mime-type");

   If browser doesn't know the type of downloaded data it should offer
"Save as" dialog to the user. And you don't need to use Stream, you can
use Writer without problems. The miracle is in the content-type, AFAIR :)

J.Ch.
--
Ing. Jozef Chocholacek                  Qbizm Technologies, Inc.
Chief Project Analyst                   ... the art of internet.
________________________________________________________________
Kralovopolska 139                          tel: +420 5 4124 2414
601 12 Brno, CZ      http://www.qbizm.com  fax: +420 5 4121 2696

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to