RE: Dowloading Vcard from Web Page
"Ajay Naphade" <[email protected]> Wed, 28 Sep 2005 17:42:55 +0530
| Newsgroups | gmane.ietf.vcard |
|---|---|
| Message-ID | <[email protected]> |
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
[email protected]
-----Original Message-----
From: Matthew Mandell [mailto:[email protected]]
Sent: Wednesday, September 28, 2005 5:04 PM
To: [email protected]
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: [email protected] [mailto:[email protected]] On
>Behalf Of Matthew Mandell
>Sent: Tuesday, September 27, 2005 7:00 PM
>To: [email protected]
>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
>
>
>
>
>.
>
>
>