[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-dev
Subject:    Re: Page REFRESH problem !
From:       "Attila Szegedi" <szegedia () freemail ! hu>
Date:       2002-11-07 7:13:16
[Download RAW message or body]

Well, I've worked only with 2.2 containers to date. Regardless, if I write a
reusable servlet that I know will be used by others (this is a major concern
for me as I'm developing reusable libraries for other people) to generate
dynamic content via a template engine, I'd want to make sure the servlet
itself makes the best effort to defeat caching and doesn't rely on filters
being configured in the webapp to provide this functionality.

Attila.

--
Attila Szegedi
home: http://www.szegedi.org


----- Original Message -----
From: "robert burrell donkin" <robertburrelldonkin@blueyonder.co.uk>
To: "Velocity Developers List" <velocity-dev@jakarta.apache.org>
Sent: 2002. november 6. 18:43
Subject: Re: Page REFRESH problem !


> if you're running a 2.3 compliant servlet container, you could put this
> kind of code into a http filter.
>
> - robert
>
> On Wednesday, November 6, 2002, at 01:47 PM, Attila Szegedi wrote:
>
> > I use the technique below to make sure pages aren't cached. Tried will
> > many
> > kinds of Netscape Navigator, IE and Opera. Usually, if everything else
> > fails, the explicit expiration date in the past does the trick :-)
> >
> > public class MyServlet extends HttpServlet {
> >     private static final String EXPIRATION_DATE;
> >
> >     static {
> >         // Generate expiration date that is one year from now in the
past
> >         GregorianCalendar expiration = new GregorianCalendar();
> >         expiration.roll(Calendar.YEAR, -1);
> >         SimpleDateFormat httpDate =
> >             new SimpleDateFormat(
> >                 "EEE, dd MMM yyyy HH:mm:ss z",
> >                 java.util.Locale.US);
> >         EXPIRATION_DATE = httpDate.format(expiration.getTime());
> >     }
> >
> >     public void doGet(HttpServletRequest request,
> >                       HttpServletResponse response)
> >         throws ServletException, IOException
> >     {
> >         ....
> >         // HTTP 1.1 browsers should defeat caching on this header
> >         response.setHeader("Cache-Control", "no-cache");
> >         // HTTP 1.0 browsers should defeat caching on this header
> >         response.setHeader("Pragma", "no-cache");
> >         // Last resort for those that ignore all of the above
> >         response.setHeader("Expires", EXPIRATION_DATE);
> >         ....
> >     }
> > }
> >
> > --
> > Attila Szegedi
> > home: http://www.szegedi.org
> >
> > ----- Original Message -----
> > From: "Juozas Baliuka" <baliuka@mail.lt>
> > To: "Velocity Developers List" <velocity-dev@jakarta.apache.org>
> > Sent: 2002. november 5. 18:57
> > Subject: Re: Page REFRESH problem !
> >
> >
> >>
> >> Hi,
> >> Some browsers/proxy servers have bugs and HTTP headers will not help.
> >>
> >> try this workaround, random links:
> >>
> >>  <a  href=http://www.mycompany.com/myservlet/?nocache=$tools.random() >
> > ....
> >>
> >>
> >>> Hi Christoph,
> >>>
> >>> Thanks for your reply though. I tried using those no-caching meta tag,
> > but
> >>> didn't help me. It is still the same behavior. Data comes out well as
> > soon
> >>> as I hit REFRESH button on IE.
> >>>
> >>> Don't know what is happening.
> >>>
> >>> -----Original Message-----
> >>> From: Christoph.Reck@dlr.de [mailto:Christoph.Reck@dlr.de]
> >>> Sent: Tuesday, November 05, 2002 7:04 AM
> >>> To: Velocity Developers List
> >>> Subject: Re: Page REFRESH problem !
> >>>
> >>>
> >>> Hi,
> >>>
> >>> you have a problem with the expiry of your browser. Try using the
proper
> >>> HTML or HTTP header tags to ensure that the page gets reloaded, see:
> >>> http://www.w3.org/TR/REC-html32#meta
> >>> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3
> >>>
> >>> I have seen this behaviour prior to IE5.0 (With Netscape browsers the
> > page
> >>> was always properly refreshed and did not come off the browser cache).
> >>>
> >>> Hope this helps,
> >>> Christoph
> >>>
> >>> Sanjay Mistry wrote:
> >>>> Hi All,
> >>>>
> >>>> I  have started developing application is Velocity for last two
weeks.
> >>>> So, please pardon me if I don't ask SMART question.
> >>>>
> >>>> Here is what happening.
> >>>>
> >>>> I have a page that checks for some data in xml file. If the data is
> >>>> not there in xml, page displays empty string. (The underlying object
> >>>> contains empty string).
> >>>>
> >>>> Let's say that variable in my template is $job for that. So, for the
> >>>> first time $job contains empty string.
> >>>>
> >>>> Later on depending upon user's actions, the data is populated in
> >>>> underlying xml file and gets persisted.
> >>>>
> >>>> Next time when I load the same page, it displays $job as an empty
> >>>> string. (although there is a data in xml file). But IF I hit REFRESH
> >>>> in my browser (IE), $job is displaying updated values.
> >>>>
> >>>> This is happening consistently and in many other pages/templates
also.
> >>>>
> >>>> Can anyone help me ?
> >>>>
> >>>> I tried looking in velocity User guide and is says somewhere, " If
the
> >>>> RHS is a property or method reference that evaluates to null, it will
> >>>> not be assigned to the LHS. It is not possible to remove an existing
> >>>> reference from the context via this mechanism."
> >>>>
> >>>> Is there anyway, we can remove the reference from context and
reinsert
> >>>> again ?
> >>>>
> >>>> Please help.
> >>>>
> >>>> Thanks.
> >>>>
> >>>> Sanjay
> >>>>
> >>>
> >>> --
> >>> :) Christoph Reck
> >>>
> >>>
> >>> --
> >>> To unsubscribe, e-mail:
> >>> <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
> >>> For additional commands, e-mail:
> >>> <mailto:velocity-dev-help@jakarta.apache.org>
> >>>
> >>> --
> >>> To unsubscribe, e-mail:
> >> <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
> >>> For additional commands, e-mail:
> >> <mailto:velocity-dev-help@jakarta.apache.org>
> >>>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> > <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
> >> For additional commands, e-mail:
> > <mailto:velocity-dev-help@jakarta.apache.org>
> >>
> >>
> >>
> >>
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:velocity-dev-unsubscribe@jakarta.apache.
> > org>
> > For additional commands, e-mail:
<mailto:velocity-dev-help@jakarta.apache.
> > org>
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:velocity-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:velocity-dev-help@jakarta.apache.org>
>
>
>
>


--
To unsubscribe, e-mail:   <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-dev-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic