On Wed, 11 Apr 2012 19:05:20 -0300, Juan Germán Castañeda Echevarria <juan...@ciencias.unam.mx> wrote:

Hi everyone,

Hi!

I want to be able to disable the browsers cache in some
pages programmatically by adding the necessary HTTP headers to the
response. I found the following recipe where it is shown how to do
something similar with an annotation and a MarkupRenderFilter
http://tapestry.apache.org/meta-programming-page-content.html.

Is that the best, only and/or current way to do it? Just want to know
before actually writing it.

Not the only one. For setting HTTP headers only, I think that approach is a little overkill. You could implement a ComponentRequestFilter, @Inject the Response object in it and that and contribute the filter to the ComponentRequestHandler service.

I've started writing the answer thinking you were asking about adding meta tags, not HTTP headers. I don't want to waste what I've wrote, so here it goes. :P

If you have a single layout component used in all pages, you can use afterRender(MarkupWriter writer) and add the meta tags through through Tapestry DOM rewriting a.k.a. get the Document from the writer parameter and and some elements. If you don't have a single layout component, you can create a mixin that does the above and apply it to the layout components. Or you could write a ComponentClassTransformWorker that applies this mixin to all pages.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to