You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by lmk <lo...@yahoo.fr> on 2008/02/14 15:10:45 UTC

[myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

hello,
I have some  issues using  ajax features with myfaces and facelets,
it seems that IE7 keep  xml request component on cache
how to avoid, disable using IE cache?

environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.

regards!
-- 
View this message in context: http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-IE7--cache--tp15480674p15480674.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

Posted by "Karr, David" <da...@wamu.net>.
You might consider a phase listener that sends the typical cache-control
headers.  I use the following (although looking at it now, I think it
should probably only need to be a response phase):

public class CacheControlPhaseListener implements PhaseListener
{
    public void beforePhase(PhaseEvent event)
    {
        FacesContext facesContext = event.getFacesContext();
        HttpServletResponse response = (HttpServletResponse)
facesContext.getExternalContext().getResponse();
        response.addHeader("Pragma", "no-cache");
        response.addHeader("Cache-Control", "no-cache");
        response.addHeader("Cache-Control", "must-revalidate");
        response.addHeader("Cache-Control", "no-store");
        response.addHeader("Expires", "Mon, 8 Aug 2006 10:00:00 GMT");
// some date in the past
    }

    public void afterPhase(PhaseEvent event) { }

    public PhaseId getPhaseId()
    {
        return PhaseId.ANY_PHASE;
    }
} 

> -----Original Message-----
> From: lmk [mailto:lotfi65@yahoo.fr] 
> Sent: Friday, February 15, 2008 12:56 AM
> To: users@myfaces.apache.org
> Subject: Re: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?
> 
> 
> 
> lmk wrote:
> > 
> > hello,
> > I have some  issues using  ajax features with myfaces and 
> facelets, it 
> > seems that IE7 keep  xml request component on cache how to avoid, 
> > disable using IE cache?
> > environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.
> > regards!
> > 
> 
> no ideas.??
> 
> thanks.
> --
> View this message in context: 
> http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-
> IE7--cache--tp15480674p15496151.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 
> 
> 

Re: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

Posted by lmk <lo...@yahoo.fr>.

lmk wrote:
> 
> hello,
> I have some  issues using  ajax features with myfaces and facelets,
> it seems that IE7 keep  xml request component on cache
> how to avoid, disable using IE cache?
> environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.
> regards!
> 

no ideas.??

thanks.
-- 
View this message in context: http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-IE7--cache--tp15480674p15496151.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

Posted by Martin Hinterndorfer <ma...@irian.at>.
Hi!

As far as I know, you can use 2 mechanisms to turn off caching:

1. Entry in the html-header tag:
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <!-- or charset=iso-8859-1-->
    <meta http-equiv="expires" content="0"/>
    <meta http-equiv="cache-control" content="no-store"/>
    <meta http-equiv="pragma" content="no-cache"/>
</head>

This might not be read by proxies and some browsers so it helps to
additionally use the solution of setting the parameters in the HttpResponse:

2. As a Phase-Listener:

in the beforePhase of the RenderResponse phase:

public class CacheControlPhaseListener
        implements PhaseListener {

   public void beforePhase(PhaseEvent event) {
        FacesContext facesContext = event.getFacesContext();
        CacheControlPhaseListenerConfig config =
getCacheControlPhaseListenerConfig();
        String viewId = facesContext.getViewRoot().getViewId();

        HttpServletResponse servletResponse
                = (HttpServletResponse) facesContext.getExternalContext
().getResponse();
        servletResponse.setHeader("expires", "0"); //is interpreted by most
browsers as "never cache page"
        servletResponse.setHeader("cache-control", "no-store");
        servletResponse.setHeader("pragma", "no-cache");
    }

    public void afterPhase(PhaseEvent event) {
        //do nothing
    }

    public PhaseId getPhaseId() {
        return PhaseId.RENDER_RESPONSE;
    }
}
Don't forget to register your phase-listener-class in the faces-config.xml:
<lifecycle>
    <phase-listener>CacheControlPhaseListener</phase-listener>
</lifecycle>


The combination of both approaches should turn off caching completely.

Kind regards,

Martin



2008/2/16, Mathias Walter <ma...@gmx.net>:
>
> Hi,
>
> > Maybe setting the http cache headers?
>
> I tried all variants and verified it with FireBug. IE ignores these
> settings. But I've the problems only with backward/forward navigation.
>
> --
> Kind regards,
> Mathias
>
> >
> > Scott
> >
> > Mathias Walter wrote:
> > > Hi,
> > >
> > > You don't have a real name. So don't expect any answer!
> > >
> > > But, I experienced similar problems with IE6 and Trinidad
> > too and could not
> > > solve it. With FireFox it works well.
> > >
> > > --
> > > Kind regards,
> > > Mathias
> > >
> > >
> > >> -----Original Message-----
> > >> From: lmk [mailto:lotfi65@yahoo.fr]
> > >> Sent: Thursday, February 14, 2008 3:11 PM
> > >> To: users@myfaces.apache.org
> > >> Subject: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?
> > >>
> > >>
> > >>
> > >> hello,
> > >> I have some  issues using  ajax features with myfaces and facelets,
> > >> it seems that IE7 keep  xml request component on cache
> > >> how to avoid, disable using IE cache?
> > >>
> > >> environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.
> > >>
> > >> regards!
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-
> > >>
> > > IE7--cache--tp15480674p15480674.html
> > > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> > >
> > >
>
>

RE: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

Posted by Mathias Walter <ma...@gmx.net>.
Hi,

> Maybe setting the http cache headers?

I tried all variants and verified it with FireBug. IE ignores these
settings. But I've the problems only with backward/forward navigation.

--
Kind regards,
Mathias 

> 
> Scott
> 
> Mathias Walter wrote:
> > Hi,
> >
> > You don't have a real name. So don't expect any answer!
> >
> > But, I experienced similar problems with IE6 and Trinidad 
> too and could not
> > solve it. With FireFox it works well.
> >
> > --
> > Kind regards,
> > Mathias
> >
> >   
> >> -----Original Message-----
> >> From: lmk [mailto:lotfi65@yahoo.fr] 
> >> Sent: Thursday, February 14, 2008 3:11 PM
> >> To: users@myfaces.apache.org
> >> Subject: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?
> >>
> >>
> >>
> >> hello,
> >> I have some  issues using  ajax features with myfaces and facelets,
> >> it seems that IE7 keep  xml request component on cache
> >> how to avoid, disable using IE cache?
> >>
> >> environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.
> >>
> >> regards!
> >> -- 
> >> View this message in context: 
> >> http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-
> >>     
> > IE7--cache--tp15480674p15480674.html
> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
> >   


Re: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

Posted by Scott O'Bryan <da...@gmail.com>.
Maybe setting the http cache headers?

Scott

Mathias Walter wrote:
> Hi,
>
> You don't have a real name. So don't expect any answer!
>
> But, I experienced similar problems with IE6 and Trinidad too and could not
> solve it. With FireFox it works well.
>
> --
> Kind regards,
> Mathias
>
>   
>> -----Original Message-----
>> From: lmk [mailto:lotfi65@yahoo.fr] 
>> Sent: Thursday, February 14, 2008 3:11 PM
>> To: users@myfaces.apache.org
>> Subject: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?
>>
>>
>>
>> hello,
>> I have some  issues using  ajax features with myfaces and facelets,
>> it seems that IE7 keep  xml request component on cache
>> how to avoid, disable using IE cache?
>>
>> environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.
>>
>> regards!
>> -- 
>> View this message in context: 
>> http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-
>>     
> IE7--cache--tp15480674p15480674.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>   


RE: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?

Posted by Mathias Walter <ma...@gmx.net>.
Hi,

You don't have a real name. So don't expect any answer!

But, I experienced similar problems with IE6 and Trinidad too and could not
solve it. With FireFox it works well.

--
Kind regards,
Mathias

> -----Original Message-----
> From: lmk [mailto:lotfi65@yahoo.fr] 
> Sent: Thursday, February 14, 2008 3:11 PM
> To: users@myfaces.apache.org
> Subject: [myfaces1.1.5][facelets 1.1.12] desable IE7 cache?
> 
> 
> 
> hello,
> I have some  issues using  ajax features with myfaces and facelets,
> it seems that IE7 keep  xml request component on cache
> how to avoid, disable using IE cache?
> 
> environement: myfaces 1.1.5,facelets 1.1.13,rich-faces 1.1.4.
> 
> regards!
> -- 
> View this message in context: 
> http://www.nabble.com/-myfaces1.1.5--facelets-1.1.12--desable-
IE7--cache--tp15480674p15480674.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.