Twan Kogels <[EMAIL PROTECTED]> writes: > I've found it after looking at the api docs. VelocityServlet has a > method "setContentType()". In this method you can set the content > type, but also add several other headers to the http header. It's a > little dirty but i works :-)
I find it odd that addHeader() didn't work, though I don't think that you should be including the trailing colon and space like in your example below. You can always override Template handleRequest(HttpServletRequest, HttpServletResponse, Context) if you want direct access to the response object. VelocityServlet's setContentType() method just delegates to the response object anyhow. protected void setContentType( HttpServletRequest request, HttpServletResponse response ) { response.setContentType( defaultContentType ); } > At 14:08 27-3-2003 +0100, you wrote: > >Hello, > > > > Is it possible to add a http header to the response object when > > using VelocityServlet? I searched the archives and found to add http > > header with the template > > <http://www.mail-archive.com/[EMAIL PROTECTED]/msg06615.html>. But > > that isn't exactly what i wanted, i want to add a header in the > > servlet, for example in the handleRequest() methode of > > VelocityServlet. > > > > >I tryed something like : > > > > ((HttpServletResponse)ctx.get(VelocityServlet.RESPONSE)).addHeader("header: > > ", "val"); > > > > >But that didn't work. Am i'm on the wrong path? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]