RE: Dowloading Vcard from Web Page
"Ajay Naphade" <[email protected]> Thu, 29 Sep 2005 13:25:58 +0530
| Newsgroups | gmane.ietf.vcard |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------=_NextPart_000_0017_01C5C4F9.57921760
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0018_01C5C4F9.57939E00"
------=_NextPart_001_0018_01C5C4F9.57939E00
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Hi,
Attached is the servlet file, modify the vcard string as per your
requirement & compile to java class file.
You will need a web application container like Tomcat
(http://jakarta.apache.org/tomcat/tomcat-5.5-doc/).
Put the servlet class file in
$TOMCAT_HOME/webapps/<SomeProject>/WEB_INF/classes/ directory
Add following to the web.xml (present in WEB-INF directory)
<!-- ExportVCard -->
<servlet>
<servlet-name>ExportVCard</servlet-name>
<servlet-class>ExportVCard</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ExportVCard</servlet-name>
<url-pattern>/ExportVCard</url-pattern>
</servlet-mapping>
In your web page call as follows:
<a href="/contacts/ExportVCard" >Download VCard</a>
This will download the .vcf file and you can open it or save to some
location.
Regards
Ajay Naphade
Project Leader - R&D
[email protected]
_____
From: Matthew Mandell [mailto:[email protected]]
Sent: Wednesday, September 28, 2005 7:02 PM
To: [email protected]
Subject: Re: Dowloading Vcard from Web Page
Could you send me an example of how to do this servlet and where to place it
on the server and how to call it, I have not programmed in years. I
appreciate the help.
Thanks
Ajay Naphade wrote:
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
.
------=_NextPart_001_0018_01C5C4F9.57939E00
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" =
name=3D"PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";
color:black;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
pre
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=3Dwhite lang=3DEN-US link=3Dblue vlink=3Dblue>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hi,<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Attached is the servlet file, =
modify the
vcard string as per your requirement & compile to java class file. =
<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>You will need a web application =
container
like Tomcat (http://jakarta.apache.org/tomcat/tomcat-5.5-doc/). =
<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Put the servlet class file in
$TOMCAT_HOME/webapps/<SomeProject>/WEB_INF/classes/ directory =
<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Add following to the web.xml =
(present in
WEB-INF directory)<o:p></o:p></span></font></p>
<p class=3DMsoNormal =
style=3D'text-indent:.5in;text-autospace:none'><font size=3D2
color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'><!-- ExportVCard =
--></span></font><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> =
<servlet></span></font><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> =
<servlet-name>ExportVCard</servlet-name></span></font><font =
size=3D2
color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> =
<servlet-class>ExportVCard</servlet-class></span></font><font=
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> =
</servlet></span></font><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> =
<servlet-mapping></span></font><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> &n=
bsp; =
<servlet-name>ExportVCard</servlet-name></span></font><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 =
color=3Dblack
face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext;background:white'> =
<url-pattern>/ExportVCard</url-pattern></span></font><font =
size=3D2
color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:"Courier New";
color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dblack face=3D"Courier =
New"><span
style=3D'font-size:10.0pt;font-family:"Courier =
New";color:windowtext;background:
white'> =
</servlet-mapping></span></font><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt;font-family:
"Courier New";color:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>In your web page call as =
follows:<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><a
href=3D"/contacts/ExportVCard" >Download =
VCard</a><o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>This will download the .vcf file =
and you
can open it or save to some location.<o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Regards<o:p></o:p></span></font></p>=
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Ajay =
Naphade<o:p></o:p></span></font></p>
<pre><font size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Project Leader - =
R&D<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><a
href=3D"mailto:[email protected]">[email protected]</=
a><o:p></o:p></span></font></pre>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
color=3Dblack face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:windowtext'>
<hr size=3D3 width=3D"100%" align=3Dcenter tabindex=3D-1>
</span></font></div>
<p class=3DMsoNormal><b><font size=3D2 color=3Dblack face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight=
:bold'>From:</span></font></b><font
size=3D2 color=3Dblack face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma;
color:windowtext'> Matthew Mandell [mailto:[email protected]] <br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wednesday, =
September 28,
2005 7:02 PM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName =
w:st=3D"on">[email protected]</st1:PersonName><br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> Re: Dowloading =
Vcard from
Web Page</span></font><font color=3Dblack><span =
style=3D'color:windowtext'><o:p></o:p></span></font></p>
</div>
<p class=3DMsoNormal><font size=3D3 color=3Dblack face=3D"Times New =
Roman"><span
style=3D'font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=3DMsoNormal><font size=3D3 color=3Dblack face=3D"Times New =
Roman"><span
style=3D'font-size:12.0pt'>Could you send me an example of how to do =
this servlet
and where to place it on the server and how to call it, I have not =
programmed
in years. I appreciate the help.<br>
<br>
Thanks<br>
<br>
<br>
Ajay Naphade wrote:<br>
<br>
<o:p></o:p></span></font></p>
<pre wrap=3D""><font size=3D2 color=3Dblack face=3D"Courier New"><span
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>I am not sure about existence java script =
which could do this.<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>But following method is tested by =
me:<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Write a servlet with its doPost method having =
following:<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>//get =
outputstream<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>OutputStream outputStream =3D =
response.getOutputStream();<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>//set MIME type for http header, extension =
vcf //content type text/plain<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>response.setContentType("text/plain"=
);<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>String fileName =3D "attachment; =
filename=3D"myvcard.vcf";<o:p></o:p></span></font></pre><pre><f=
ont
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>response.setHeader("content-disposition&q=
uot;,fileName);<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> =
<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>:<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>:<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>//write the vcard string to the =
outputstream<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>outputStream.write(vcardString); =
outputStream.close();<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>In your web page, <a =
href=3D"servlet-path-and-name">Download =
Vcard</a><o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>(Remember to configure the web.xml for the =
servlet class name.)<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Regards<o:p></o:p></span></font></pre><pre><fo=
nt
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Ajay =
Naphade<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Project Leader - =
R&D<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><a
href=3D"mailto:[email protected]">[email protected]</=
a><o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>-----Original =
Message-----<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>From: Matthew Mandell [<a
href=3D"mailto:[email protected]">mailto:[email protected]</a=
>] <o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Sent: Wednesday, September 28, 2005 5:04 =
PM<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>To: <a
href=3D"mailto:[email protected]">[email protected]</=
a><o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Subject: Re: Dowloading Vcard from Web =
Page<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Thanks, but how do you do that? Are the any =
stock scripts out there that <o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>do =
it?<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Matthew<o:p></o:p></span></font></pre><pre><fo=
nt
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Ajay Naphade =
wrote:<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> <o:p></o:p></span></font></pre>
<blockquote style=3D'margin-top:5.0pt;margin-bottom:5.0pt' =
type=3Dcite><pre wrap=3D""><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Hi,<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Straight href will do but you should call a =
java program, which will set<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> =
<o:p></o:p></span></font></pre></blockquote>
<pre wrap=3D""><font size=3D2 color=3Dblack face=3D"Courier New"><span
style=3D'font-size:10.0pt'>the<o:p></o:p></span></font></pre><pre><font =
size=3D2
color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> <o:p></o:p></span></font></pre>
<blockquote style=3D'margin-top:5.0pt;margin-bottom:5.0pt' =
type=3Dcite><pre wrap=3D""><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>header "Content-disposition" and =
write the file to output =
stream.<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Regards,<o:p></o:p></span></font></pre><pre><f=
ont
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Ajay =
Naphade<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>-----Original =
Message-----<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>From: <a
href=3D"mailto:[email protected]">[email protected]=
</a> [<a
href=3D"mailto:[email protected]">mailto:owner-imc-vcard@mail.=
imc.org</a>] On<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Behalf Of Matthew =
Mandell<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Sent: Tuesday, September 27, 2005 7:00 =
PM<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>To: <a
href=3D"mailto:[email protected]">[email protected]</a><o:p></o:p></span>=
</font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Subject: Dowloading Vcard from Web =
Page<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>I am trying to put Vcards on a web page for =
downloading. The link is a =
<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>straight "A Href=3D". The browsers =
are treating it as a flat text file and =
<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>showing the info rather than asking to =
download the file.<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>Is there a Java script or some way to trick =
the browser to ask it to <o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>download rather than should the =
text?<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>thanks<o:p></o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'>.<o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> <o:p></o:p></span></font></pre><pre><font
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> =
<o:p></o:p></span></font></pre></blockquote>
<pre wrap=3D""><font size=3D2 color=3Dblack face=3D"Courier New"><span
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><fon=
t
size=3D2 color=3Dblack face=3D"Courier New"><span =
style=3D'font-size:10.0pt'> <o:p></o:p></span></font></pre></div>
</body>
</html>
------=_NextPart_001_0018_01C5C4F9.57939E00--
------=_NextPart_000_0017_01C5C4F9.57921760
Content-Type: application/octet-stream;
name="ExportVCard.java"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="ExportVCard.java"
import java.io.*;
import java.util.Properties;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Program Name : ExportVCard
* Creation Date : 29-09-2005
* Modified Date : 29-09-2005
* Author : Ajay Naphade [email protected]
* Description : This servlet will be get the image buffer from vcard =
and
* throw it in output stream
*/
public class ExportVCard extends HttpServlet=20
{
private Properties properties =3D null;
=09
public void init(ServletConfig config) throws ServletException
{
super.init(config);//pass servlet config to its parent
}
public void doGet(HttpServletRequest request, HttpServletResponse =
response)
throws ServletException, IOException
{
doPost(request,response);
}
/**
* This method is invoked when the servlet receives the request from =
the
* html:img tag.=20
* @return
*
*/
public void doPost(HttpServletRequest request, HttpServletResponse =
response)
throws ServletException, IOException
{
String vcard =3D "";
//get outputstream
OutputStream outputStream =3D response.getOutputStream();
//set MIME type for http header
//extension vcf
//content type text/plain or text/x-vcard
//response.setContentType("text/plain");
response.setContentType("text/x-vcard");
//Response.AddHeader "content-disposition","attachment; =
filename=3Dfname.ext"
String fileName =3D "attachment; filename=3Dauthor.vcf";
response.setHeader("content-disposition",fileName);
=20
=20
//assign the vcard string here
vcard =3D "BEGIN:VCARD\r\n" +
"VERSION:2.1\r\n" +
"N:Naphade;Ajay;Uttamrao;Mr.;Sr.\r\n" +
"FN:Mr. Ajay U. Naphade\r\n" +
"BDAY:19720708\r\n" +
"TEL;VOICE;WORK:918028565808\r\n" +
"EMAIL;INTERNET:[email protected]\r\n" +
"UID:-72bad57e:1067312c624:-8000\r\n" +
"REV:2005-81-20T15:57:21Z\r\n" +
"END:VCARD";
=20
//write to outputstream
outputStream.write(vcard.getBytes());
outputStream.close();
}
=09
}//end of class
------=_NextPart_000_0017_01C5C4F9.57921760--