Re: How to open application using the extension of a file in java
Thursday, December 15, 2005 03:17 AM
Why u are using the applet for downloading a file i am not understanding. for downloading a file from server u can read that file at server using streams and set the content type(MIME-TYPE) and write it to the out put stream( out variable in jsp ).this will download the file for u.
and u asked how to open a file at client side after downloading here u can use response HEADERS.u can use some thing like below code
response.setHeader( "Content-Disposition","inline;fileName='temp.ppt'" );
this header will set the disposition type of ur content( download file )
options for content-disposiotion
inline:it will search the appropriate application for opening the downloaded file and opens the file( in our example it will open it in powerpoint )suppose if it fails to find the application at client side it will give a option to save that file.
attachment:it will force the browser to dispose the content as an attachment.
Note : u need to set the content-disposition before wrting any thing into the outpt stream( i.e out )
All the best
Krishna Rajendra Alapati :)