[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Dowloading Vcard from Web Page
I am not sure about existence java script which could do this.
But following method is tested by me:
Write a servlet with its doPost method having following:
//get outputstream
OutputStream outputStream = response.getOutputStream();
//set MIME type for http header, extension vcf //content type text/plain
response.setContentType("text/plain");
String fileName = "attachment; filename="myvcard.vcf";
response.setHeader("content-disposition",fileName);
:
:
//write the vcard string to the outputstream
outputStream.write(vcardString); outputStream.close();
In your web page, <a href="servlet-path-and-name">Download Vcard</a>
(Remember to configure the web.xml for the servlet class name.)
Regards
Ajay Naphade
Project Leader - R&D
ajaynaphade@xxxxxxxxxxxxxxx
-----Original Message-----
From: Matthew Mandell [mailto:savewestport@xxxxxxxxxx]
Sent: Wednesday, September 28, 2005 5:04 PM
To: ajaynaphade@xxxxxxxxxxxxxxx
Subject: Re: Dowloading Vcard from Web Page
Thanks, but how do you do that? Are the any stock scripts out there that
do it?
Matthew
Ajay Naphade wrote:
>Hi,
>
>Straight href will do but you should call a java program, which will set
the
>header "Content-disposition" and write the file to output stream.
>
>Regards,
>Ajay Naphade
>
>-----Original Message-----
>From: owner-imc-vcard@xxxxxxxxxxxx [mailto:owner-imc-vcard@xxxxxxxxxxxx] On
>Behalf Of Matthew Mandell
>Sent: Tuesday, September 27, 2005 7:00 PM
>To: imc-vcard@xxxxxxx
>Subject: Dowloading Vcard from Web Page
>
>
>I am trying to put Vcards on a web page for downloading. The link is a
>straight "A Href=". The browsers are treating it as a flat text file and
>showing the info rather than asking to download the file.
>
>Is there a Java script or some way to trick the browser to ask it to
>download rather than should the text?
>
>thanks
>
>
>
>
>.
>
>
>