This is happening because the DefaultTargetValve attempts to set the ContentType regarless of whether the writer has already been opened. There really should be a way round this in Turbine. I guess what you really need is to add some data to the rundata which could be output in the DefaultTargetValve.
Ideas guys? > -----Original Message----- > From: Aravinda Addala [mailto:[EMAIL PROTECTED]] > Sent: 31 January 2002 16:43 > To: Turbine Users List > Subject: RE: Please help. Content type: Sending pdf content to the > browser > > > I have tried using data.setContentType("unknown"). When I run this action, > browser asks me to open an application associated with this type > of content. > I opened it in WordPad. Turbine seems is appending the following error to > the output stream. > > The first part of the output (from %FDF-1.2 to %%EOF) is a valid fdf > document and works if I copy and paste in a blank file. > But Turbine seems to append everything after %%EOF. > > May be somebody could be able to help. > > Thank you, > Aravind. > > OUTPUT IS: > > %FDF-1.2 > %���� > 1 0 obj > << > /FDF << /Fields 2 0 R /F (http://localhost:7001/parioapp/ToPDF.pdf)>> > >> > endobj > 2 0 obj > [ > << /T (test)/V [ (test1)(test2)] >> > ] > endobj > trailer > << > /Root 1 0 R > > >> > %%EOF > <pre> > java.lang.IllegalStateException: Attempt to change ContentType > after calling > getWriter() (cannot change charset from 'null' to 'ISO-8859-1') > at > weblogic.servlet.internal.ServletResponseImpl.setEncoding(ServletR > esponseImp > l.java:725) > at > weblogic.servlet.internal.ServletResponseImpl.setLocale(ServletRes > ponseImpl. > java:261) > at > org.apache.turbine.pipeline.DefaultTargetValve.execute(DefaultTarg > etValve.ja > va:142) > at > org.apache.turbine.pipeline.DefaultTargetValve.invoke(DefaultTarge > tValve.jav > a:122) > at > org.apache.turbine.pipeline.TurbinePipeline.invokeNext(TurbinePipe > line.java: > 223) > at > org.apache.turbine.pipeline.DefaultActionValve.invoke(DefaultActio > nValve.jav > a:148) > at > org.apache.turbine.pipeline.TurbinePipeline.invokeNext(TurbinePipe > line.java: > 223) > at > org.apache.turbine.pipeline.TurbinePipeline.invoke(TurbinePipeline > .java:205) > at org.apache.turbine.Turbine.doGet(Turbine.java:282) > at org.apache.turbine.Turbine.doPost(Turbine.java:329) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStu > bImpl.java > :265) > at > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStu > bImpl.java > :200) > at > weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAp > pServletCo > ntext.java:2456) > at > weblogic.servlet.internal.ServletRequestImpl.execute(ServletReques > tImpl.java > :2039) > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) > rethrown as org.apache.turbine.TurbineException: Attempt to change > ContentType after calling getWriter() (cannot change charset from > 'null' to > 'ISO-8859-1') > at > org.apache.turbine.pipeline.DefaultTargetValve.invoke(DefaultTarge > tValve.jav > a:127) > at > org.apache.turbine.pipeline.TurbinePipeline.invokeNext(TurbinePipe > line.java: > 223) > at > org.apache.turbine.pipeline.DefaultActionValve.invoke(DefaultActio > nValve.jav > a:148) > at > org.apache.turbine.pipeline.TurbinePipeline.invokeNext(TurbinePipe > line.java: > 223) > at > org.apache.turbine.pipeline.TurbinePipeline.invoke(TurbinePipeline > .java:205) > at org.apache.turbine.Turbine.doGet(Turbine.java:282) > at org.apache.turbine.Turbine.doPost(Turbine.java:329) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStu > bImpl.java > :265) > at > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStu > bImpl.java > :200) > at > weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAp > pServletCo > ntext.java:2456) > at > weblogic.servlet.internal.ServletRequestImpl.execute(ServletReques > tImpl.java > :2039) > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) > > > -----Original Message----- > From: Aaron Smuts [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 4:06 PM > To: Turbine Users List > Subject: RE: Please help. Content type: Sending pdf content to the > browser > > > You tried the buffered file server? > > Then you might need a PDF serving servlet so you have control. Sounds > funny. Can you send the entire class. > > > -----Original Message----- > > From: Aravinda Addala [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 31, 2002 10:56 AM > > To: Turbine Users List > > Subject: RE: Please help. Content type: Sending pdf content to > the browser > > > > > > It doesn't actually work in Turbine 3 . > > All it output on the screen is the plain text of the FDF document(Adobe > > FDF > > api). > > > > Thanks for the reply. > > Aravinda > > > > > > > > -----Original Message----- > > From: Fabio Daprile [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 31, 2002 2:51 PM > > To: Turbine Users List > > Subject: Re: Please help. Content type: Sending pdf content to the > > browser > > > > > > This is how i send files to the browser. > > All documents are stored in a table in MySql, in a blob field. > > For pdf files the content_type is "application/pdf". > > I use turbine 2. > > > > _attach = (Attachments)(_trans.getAttachmentss().elementAt(0)); > > > > _contentType = _attach.getContenttype() + ";name=" + "\"" + > > _attach.getFilename() + "\""; > > data.getResponse().setContentType(_contentType); > > data.getResponse().getOutputStream().write(_attach.getContent()); > > > > hope this can help you. > > > > Greetings. > > > > Fabio Daprile > > > > Aravinda Addala wrote: > > > > >Hi, > > > > > >I have read several postings about sending a different content to the > > >browser. I am trying to generate a pdf using FDF in my action. > I get the > > >content displayed as plain text. I tried many ways ( I had set the > > content > > >type both in Response and RunData objects in my action. Also > tried to use > > >data.setContentType in the template. Nothing worked). The same > code works > > >fine if I use that in a Servlet outside turbine. > > >I am using turbine 3. > > > > > >Please help. > > > > > >Thanks in advance. > > >Aravinda > > > > > > > > > > > >-- > > >To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > >For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > -- > > > > > > W�rth Phoenix Srl > > Via Kravogl 4, I-39100 Bolzano > > Tel: +39 0471/564111 > > Fax: +39 0471/564122 > > > > mailto:[EMAIL PROTECTED] > > http://www.wuerth-phoenix.com > > > > > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > > -- > > To unsubscribe, e-mail: <mailto:turbine-user- > > [EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:turbine-user- > > [EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
