You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jacob von Eyben <je...@nordija.dk> on 2005/08/15 16:45:37 UTC

set http headers (cache-control, etc) in tapestry

Hi,

I can not find the answer through google, but I hope you can help me.
Is it possible to set http headers like:
pragma: no-cache
cache-control: no-cach
through some tapestry configuration?

If not, I will map a HttpFilter on .../app that will do the work for me,
but of course it is possible in tapesty right? :-)

I use tapesty 3 by the way.

Regards
Jacob von Eyben
Nordija A/S

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set http headers (cache-control, etc) in tapestry

Posted by Chris Chiappone <ch...@gmail.com>.
You could also create a delegate that implements IRender.
Then create the followin method:

public void render(IMarkupWriter writer, IRequestCycle cycle){
   List attList = new ArrayList();
   Attribute att = new Attribute("http-equiv", "Pragma");
   attList.add(att);
   att = new Attribute("Content", "NO-CACHE");
   attList.add(att);
   createMetaTag(writer, attributeList);
}

private void createMetaTag(IMarkupWriter writer, List atts){
   writer.begin("meta");
   for(int i=0;i<atts.size();i++){
      Attribute att = (Attribute) atts.get(i);
      writer.attribute(att.getName(), att.getValue());
   }
   writer.closeTag();
}



On 8/15/05, Patrick Casey <pa...@adelphia.net> wrote:
> 
>        I think you can just put them in your .html files and/or your border
> component (if you have one, can't you) e.g.
> 
> 
> <span jwcid="$content$">
> <span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" title="Demo
> Application" />
> 
> <html>
>        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
>      <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
> </html>
> </span>
> 
> > -----Original Message-----
> > From: Jacob von Eyben [mailto:jeyben@nordija.dk]
> > Sent: Monday, August 15, 2005 7:46 AM
> > To: tapestry-user@jakarta.apache.org
> > Subject: set http headers (cache-control, etc) in tapestry
> >
> > Hi,
> >
> > I can not find the answer through google, but I hope you can help me.
> > Is it possible to set http headers like:
> > pragma: no-cache
> > cache-control: no-cach
> > through some tapestry configuration?
> >
> > If not, I will map a HttpFilter on .../app that will do the work for me,
> > but of course it is possible in tapesty right? :-)
> >
> > I use tapesty 3 by the way.
> >
> > Regards
> > Jacob von Eyben
> > Nordija A/S
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
~chris

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set http headers (cache-control, etc) in tapestry

Posted by Jacob von Eyben <je...@nordija.dk>.
Ok, I think I will stick to the filter solution I mentioned in my question.
It will also take effect on *.pdf files as long as I map the filter correct.

Thanks for the answers.

Regards
Jacob von Eyben
Nordija A/S

>
> On Aug 15, 2005, at 11:12 AM, Patrick Casey wrote:
>
>>     So it sure looks like it's working unless my limited html skills
>> have escaped me and your browser ignores the second set of meta
>> tags? On
>> FireFox (1.0.6), it's definitely parsing the NO-CACHE meta tags
>> because they
>> show up in the pageinfo dialog (I'd include a ss but I don't want
>> to spam
>> the list).
>
> It appears to be working over here too, but it does not validate
> *shrug*.
>
> --
> Kevin
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set http headers (cache-control, etc) in tapestry

Posted by Kevin Menard <km...@servprise.com>.
On Aug 15, 2005, at 11:12 AM, Patrick Casey wrote:

>     So it sure looks like it's working unless my limited html skills
> have escaped me and your browser ignores the second set of meta  
> tags? On
> FireFox (1.0.6), it's definitely parsing the NO-CACHE meta tags  
> because they
> show up in the pageinfo dialog (I'd include a ss but I don't want  
> to spam
> the list).

It appears to be working over here too, but it does not validate  
*shrug*.

-- 
Kevin

RE: set http headers (cache-control, etc) in tapestry

Posted by Patrick Casey <pa...@adelphia.net>.
	Well, the code snippet I linked to below is from my actual border
component, and here's what the output looks like:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!-- Application: Corinna -->
<!-- Page: LoginSuccess -->
<!-- Generated: Mon Aug 15 08:08:11 PDT 2005 -->
<html>
<head>
<meta name="generator" content="Tapestry Application Framework, version
3.0.3"/>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<title>Demo Application</title>
<link rel="stylesheet" type="text/css" href="/Corinna/css/corinna.css"/>
</head></html>
<!-- Render time: ~ 0 ms -->

<html>

    	<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
       	<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

<head>

</head>

	So it sure looks like it's working unless my limited html skills
have escaped me and your browser ignores the second set of meta tags? On
FireFox (1.0.6), it's definitely parsing the NO-CACHE meta tags because they
show up in the pageinfo dialog (I'd include a ss but I don't want to spam
the list).

	--- Pat

> -----Original Message-----
> From: Kevin Menard [mailto:kmenard@servprise.com]
> Sent: Monday, August 15, 2005 8:08 AM
> To: Tapestry users
> Cc: jeyben@nordija.dk
> Subject: Re: set http headers (cache-control, etc) in tapestry
> 
> Hi Patrick,
> 
> On Aug 15, 2005, at 10:54 AM, Patrick Casey wrote:
> 
> >
> >     I think you can just put them in your .html files and/or your
> > border
> > component (if you have one, can't you) e.g.
> >
> >
> > <span jwcid="$content$">
> > <span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" title="Demo
> > Application" />
> >
> > <html>
> >         <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
> >       <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
> > </html>
> > </span>
> 
> You mentioned this once before, but I'm pretty sure this is going to
> render invalid HTML.  The Shell component should write out its own
> head block.  Feel free to correct me if I'm wrong though.
> 
> For such things, I provide a bean to the delegate parameter of the
> Shell component and all is good.  Not the simplest solution I could
> think of, but it does work.
> 
> --
> Kevin



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set http headers (cache-control, etc) in tapestry

Posted by Kevin Menard <km...@servprise.com>.
Hi Patrick,

On Aug 15, 2005, at 10:54 AM, Patrick Casey wrote:

>
>     I think you can just put them in your .html files and/or your  
> border
> component (if you have one, can't you) e.g.
>
>
> <span jwcid="$content$">
> <span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" title="Demo
> Application" />
>
> <html>
>         <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
>       <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
> </html>
> </span>

You mentioned this once before, but I'm pretty sure this is going to  
render invalid HTML.  The Shell component should write out its own  
head block.  Feel free to correct me if I'm wrong though.

For such things, I provide a bean to the delegate parameter of the  
Shell component and all is good.  Not the simplest solution I could  
think of, but it does work.

-- 
Kevin

RE: set http headers (cache-control, etc) in tapestry

Posted by Patrick Casey <pa...@adelphia.net>.
	I think you can just put them in your .html files and/or your border
component (if you have one, can't you) e.g.


<span jwcid="$content$">
<span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" title="Demo
Application" />

<html>
    	<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
      <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</html>
</span>

> -----Original Message-----
> From: Jacob von Eyben [mailto:jeyben@nordija.dk]
> Sent: Monday, August 15, 2005 7:46 AM
> To: tapestry-user@jakarta.apache.org
> Subject: set http headers (cache-control, etc) in tapestry
> 
> Hi,
> 
> I can not find the answer through google, but I hope you can help me.
> Is it possible to set http headers like:
> pragma: no-cache
> cache-control: no-cach
> through some tapestry configuration?
> 
> If not, I will map a HttpFilter on .../app that will do the work for me,
> but of course it is possible in tapesty right? :-)
> 
> I use tapesty 3 by the way.
> 
> Regards
> Jacob von Eyben
> Nordija A/S
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org