logo       

RE: content type: msg#00182

jakarta.velocity.user

Subject: RE: content type

That depends on the application that actually merges
the template with your context. Are you using the
VelocityServlet then you can simply override the
method setContentType(...) and set the content-type.

If you want to set the content-type *within* your
template, then you can't use VelocityServlet since
it renders directly to the servlet's OutputStream.
You would have to implement some kind of buffer, which
is sent to the OutputStream after the template has
been rendered. So you could do something like

$servlet.setContentType("...")

from within your template. But, anyway I would consider
changing the content-type from within a template as
a bad design choice.

Peter


> -----Original Message-----
> From: Johnny Dynn [mailto:john_dynn@xxxxxxxx]
> Sent: Tuesday, November 26, 2002 6:30 PM
> To: velocity-user@xxxxxxxxxxxxxxxxxx
> Subject: content type
>
>
> Hi, I was just wondering if anyone knew if it was
> possible to change the content type in an actual .vm
> file itself? If so, how?
>
> I know it can be done in the velocity.properties file
> but I would like to do it on a per-file basis.
>
> Thanks,
>
> jd
>
> ______________________________________________________________
> ________
> Post your free ad now! http://personals.yahoo.ca
>
> --
> To unsubscribe, e-mail:
> <mailto:velocity-user-> unsubscribe@xxxxxxxxxxxxxxxxxx>
> For
> additional commands,
> e-mail: <mailto:velocity-user-help@xxxxxxxxxxxxxxxxxx>
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise