Hi everyone.

Is it possible to set ContentType "text/plain" inside HTTP response?
Among bunch of velocity screens for generating text/html pages, I want one
screen to generate text/plain content.
Thus as usual, I created my TextGenerator.vm template with content, and
TextGenerator.java class as this :

public class TextGenerator extends VelocityScreen {

    protected void doBuildTemplate(RunData data, Context context) throws
Exception {
        HttpServletResponse resp = data.getResponse();
        resp.setHeader("Content-Type", "text/plain");
    }
}

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



-- 
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