----- Original Message ----- 
From: "Jeffery Painter" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[email protected]>
Sent: Monday, January 31, 2005 2:06 PM
Subject: Re: How to set content type for plain/text generation


> On Mon, 31 Jan 2005, Vjeran Marcinko wrote:
> > There are 2 problems :
> > 1. I had to create TextGenerator.vm layout template inside
modules/layouts
> > directory, that contains only following :
> > $screen_placeholder
> > thus this screen wouldn't be placed inside usual Default.vm for other
HTML
> > screens. Is there some more elegant way ?
> > 2. More serious - generated stuff didn't have ContentType set to
> > "text/plain" but "text/html" (I can see that in page details in my
Firefox)
> > ?! How can I set it?
> >
> > Thanx,
> > Vjeran
> >

> // plain text screen - set headers etc.
> public class TextScreen extends VelocityScreen {
>
>     private static String CONTENT_TYPE = "text/plain";
>
>     public void doBuildTemplate(RunData data, Context context) {
>         data.setLayout(null);
>         data.setContentType(CONTENT_TYPE);
>
>         HttpServletResponse resp = data.getResponse();
>         resp.setHeader("Content-Type", CONTENT_TYPE);
>     }
> }

Thanx man. Though only the second (more important) problem was solved. I
still had to have layout .vm file containing only $screen_placeholder to be
able to generate page. Otherwise, it gave me some corrupted stuff...
RunData.setLayout(null) obviously doesn't work for this.

-Vjrean



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.2 - Release Date: 28.1.2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to