Re: Custom agent and setContentType
"Robson Miranda" <[email protected]> Mon, 30 Dec 2002 23:17:10 -0200
| Newsgroups | gmane.comp.java.tapestry.devel |
|---|---|
| Message-ID | <001c01c2b06a$57d9f900$0100000a@casa> |
Got it! The correct contentType is "application/pdf"... Robson. ----- Original Message ----- From: "Robson Miranda" <[email protected]> To: "Simon Robins" <[email protected]>; <[email protected]> Sent: Monday, December 30, 2002 11:02 PM Subject: Re: [Tapestry-developer] Custom agent and setContentType > I already set Content-Lenght. I also tried with the "Content-Disposition" > header, but this way IE will prompt me if I want to save or download the > file. > > The relevant part of my code is: > > cycle.getRequestContext().getResponse().setContentLength(news.getFileSize()) > ; > cycle.getRequestContext().getResponse().setHeader ("Content-Disposition", > "attachment; filename=testFile.pdf"); > os.setContentType("application/x-pdf"); > > If I don't put the Content-Disposition header, IE will open the "Open With" > dialog box, or try to save with the name "app". > > Robson > > ----- Original Message ----- > From: Simon Robins > To: [email protected] > Sent: Monday, December 30, 2002 10:55 PM > Subject: Re: [Tapestry-developer] Custom agent and setContentType > > > >From memory you need to also add the Content-Length header. > > On Tuesday, December 31, 2002, at 12:35 am, Robson Miranda wrote: > > > Hi... > > I don't know if this is a FAQ, but... I'm trying to send a PDF file to the > browser, using a custom service. > In it's service() method, I set the contentType to "application/x-pdf", but > Internet Explorer insists in ask the user if the file must be opened or > saved. I think IE is ignoring the Content Type header. > I'm doing something wrong or there is some known trick to do this work? I > can send the service class I did, if it helps. > > Thanks > > Robson > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Tapestry-developer mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tapestry-developer > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf