How to open application using the extension of a file in java
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sreekanth_manga
Posted On:   Thursday, December 15, 2005 12:08 AM

Hi all,
My question is as follows:

I have a applet in my webserver which loads with a page .What the
applet does is it downloads a file (may be of any type).For this i
wrote a signed applet.Now comes the exact problem.As soon as the file
is downloaded into clients system,I want the applet to launch the
default application for the MIME type or extension.

How could this be done?

Is there any possibilty to get the list of applications assosiated with
that extension or MIME.

Thank you for listening to my problem

Re: How to open application using the extension of a file in java

Posted By:   Anonymous  
Posted On:   Thursday, December 15, 2005 03:17 AM

Hi Srikanth,

    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 :)
About | Sitemap | Contact