Article View: borland.public.jbuilder.java.language
Article #8122Re: Servlet Return MIME types
From: Rich Wilkman
Date: Thu, 19 Apr 2001 15:35
Date: Thu, 19 Apr 2001 15:35
40 lines
2208 bytes
2208 bytes
David:
Try posting it in the servlets-jsp newsgroup here.
-Rich
David Hanson wrote:
>
> 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:
<3ADF05C5.F433ED0C@formlessvoid.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3addf73a_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,cdcc1aeadd96c47 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-19 08:50:07 PST Message-ID: <3ADF05C5.F433ED0C@formlessvoid.com> Date: Thu, 19 Apr 2001 08:35:33 -0700 From: Rich Wilkman <richw@formlessvoid.com> Reply-To: richw@formlessvoid.com X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Servlet Return MIME types References: <3addf73a_2@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 165.227.58.108 X-Trace: dnews 987694543 165.227.58.108 (19 Apr 2001 08:35:43 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!dnews