Re: cache-control
DavidSeanTaylor <[email protected]> Fri, 12 Aug 2016 07:55:19 -0700
| Newsgroups | gmane.comp.jakarta.jetspeed.user |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_2678F297-637B-449C-97D1-957BFAE3F48E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
Looks like you are using some release of Jetspeed-1. That project has =
been retired since 2008.
https://portals.apache.org/jetspeed-1/ =
<https://portals.apache.org/jetspeed-1/>
Seems the cache header logic is hard-coded, so you=E2=80=99ll have to =
override JetspeedVelocityPage in TurbineResources.properties with your =
own implementation.
See TurbineResources.properties
services.VelocityService.default.page =3D JetspeedVelocityPage
Then see JetspeedVelocityPage, it calls super.doBuildBeforeAction, which =
contains the hard-coding in JetspeedTemplatePage.java:
switch (httpLifetime)
{
case -1:
break;
case 0:
data.getResponse().setHeader("Cache-Control", "no-cache");
data.getResponse().setHeader("Pragma", "no-cache");
data.getResponse().setDateHeader("Expires", 0);
data.getResponse().setDateHeader("Last-Modified", =
System.currentTimeMillis());
break;
default:
data.getResponse().setHeader("Cache-Control", "max-age=3D" + =
httpLifetime);
data.getResponse().setDateHeader("Expires", =
System.currentTimeMillis() + (httpLifetime * 1000));
data.getResponse().setDateHeader("Last-Modified", =
System.currentTimeMillis());
break;
}
To override this behavior, simply write your own velocity page handler =
extending JetspeedVelocityPage, and override the doBuildBeforeAction to =
include your required headers, don=E2=80=99t call =
super.doBuildBeforeAction, and then plug your handler into =
TurbineResources.properties
services.VelocityService.default.page =3D MyVelocityPage
> On Aug 11, 2016, at 10:06 PM, Usha Ladkani <[email protected]> =
wrote:
>=20
> It says - JetspeedResources.properties,v 1.1.1326.2 2012/05/31 =
21:38:56
>=20
> In this property I see below
>=20
> #########################################
> # HTTP Page header #
> #########################################
> # http.lifetime is the lifetime of the page as set in the
> # HTTP Headers
> # -1 =3D Do not set cache related headers (Jetspeed 1.3a1 behavior)
> # 0 =3D set the following http headers
> # Cache-Control =3D "no-cache"
> # Last-Modified =3D (current time)
> # Pragma =3D "no-cache"
> # Expires =3D "0"
> # n where n is the number of seconds:
> # Cache-Control =3D "max-age: n" where n is the number of =
seconds
> # Last-Modified =3D (current time)
> # Expires =3D (current time + n seconds)
> http.lifetime=3D1
>=20
>=20
> #########################################
>=20
>=20
> Looks like this only can set Cache-Control to no-cache or max-age.:
>=20
> Can you please tell me which version are you using and share your
> JetspeedResources.properties
--Apple-Mail=_2678F297-637B-449C-97D1-957BFAE3F48E--