Mmmmm... Ok. I tried with your first advice but using a VelocityScreen...
Everything seems to work fine, but I don't know why I get some extra code at
the beginning and at the end with this: "Turbine - A Servlet Framework for
building Secure Dynamic Websites". Any idea what could be happening? I
suspect the data.setLayoutTemplate("/Empty.html"); method is not to be
working, but I am not sure...
Rodrigo
----- Original Message -----
From: "Jeffery Painter" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Thursday, August 14, 2003 2:54 PM
Subject: Re: How do I send a text file using a Velocity Screen?
>
> oops.. that is correct ;) this method would work I think extending a
> securescreen or velocityscreen if you still want to enforce security on
> your text file output.
>
> if you just want to send plain text, and not use a screen class, could you
> implement a rawscreen with the following methods
>
>
> public String getContentType(RunData data)
> {
> return "plain/text";
> };
>
> protected final void doOutput(RunData data) throws Exception
> {
> String textdata = ""; // stuff text in here
>
> javax.servlet.http.HttpServletResponse response =
data.getResponse();
> javax.servlet.ServletOutputStream out =
response.getOutputStream();
> out.println( textdata );
> }
> else
> {
> throw new Exception("output stream is null");
> }
> }
>
>
> I think that should do it... not tested but should give you a start.
>
> good luck,
>
> Jeff Painter
>
>
>
> On Thu, 14 Aug 2003, Rodrigo Reyes wrote:
>
> > But the raw screen doesn't have a context. Where do I put the objects I
want
> > to use in the template?
> >
> > Rodrigo
> > ----- Original Message -----
> > From: "Jeffery Painter" <[EMAIL PROTECTED]>
> > To: "Turbine Users List" <[EMAIL PROTECTED]>
> > Sent: Thursday, August 14, 2003 12:57 PM
> > Subject: Re: How do I send a text file using a Velocity Screen?
> >
> >
> > >
> > > use a rawscreen instead of velocity screen in your screen class file
that
> > > will match your vm file.
> > >
> > > in your vm file you can add this to the top, although probably not
needed
> > > for just plain text... the setLayoutTemplate() will override pulling
the
> > > system default template. You should create the PlainText.vm in layouts
as
> > > an empty file.
> > >
> > > Text.vm -->
> > >
> > >
> > > $data.setContentType( "plain/text" )
> > > $data.setLayoutTemplate( "/PlainText.vm" )
> > >
> > > $textData
> > >
> > >
> > > hope that helps,
> > >
> > > Jeff
> > >
> > > On Thu, 14 Aug 2003, Rodrigo Reyes wrote:
> > >
> > > > Hi all
> > > > Is there any way to user the Velocity Screen functionality and
send
> > a
> > > > text file to the browser? I know HTML is a text file, but I would
like
> > the
> > > > browser to recognize it as text, not as HTML. Any ideas?
> > > >
> > > > Rodrigo
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
[EMAIL PROTECTED]
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]