Article View: borland.public.jbuilder.java.language
Article #8109Servlet Return MIME types
From: David Hanson
Date: Wed, 18 Apr 2001 20:17
Date: Wed, 18 Apr 2001 20:17
33 lines
2098 bytes
2098 bytes
Not sure where to post this so I'll try here...
I've written a set of java servlets that return a variety of data to the
browser for display. Most of the time it's strings... XML, and such. Now I
want to return a PDF document. I programmably create my PDF, turn it into a
stream (not a file) set the response.setContentType to be application/pdf
and IE does not know what it is. Netscape have no problem with it at all.
I was wondering what, if any, is the correct way to tell IE the content type
for my PDF.
code sample
--creates a new XML parser
UTL_xml mxml = new UTL_xml();
--loads it with the current thing to be done
mxml.loadXML(strResponse);
--if it finds the tTAG in the XML doc
if( mxml.isFound("DAT.CONTENT")
--get the content type (application/pdf) and set it
setContentType(mxml.getField("DAT.CONTENT"));
--set the content type on the Servlet responce object
response.setContentType(getContentType());
--write the sftream out to the response outgoing stream
curPD.getOutputstream().writeTo(response.getOutputStream());
}
blah blah blah
Thanks
Dave
Technical Details
Message-ID:
<3addf73a_2@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,cdcc1aeadd96c47,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-18 14:34:05 PST Reply-To: "David Hanson" <dhanson@pangaeainc.com> From: "David Hanson" <dhanson@pangaeainc.com> Newsgroups: borland.public.jbuilder.java.language Subject: Servlet Return MIME types Date: Wed, 18 Apr 2001 14:17:17 -0600 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 NNTP-Posting-Host: 209.91.97.160 Message-ID: <3addf73a_2@dnews> X-Trace: dnews 987625274 209.91.97.160 (18 Apr 2001 13:21:14 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews