On Mar 15, 2011, at 8:24 AM, Marius Dumitru Florea wrote:
On 03/14/2011 07:33 PM, Paul Libbrecht wrote:
For the sake of the users list... once the issue below is fixed (I hope 3.0), I can set a
correct cache header of one minute with the following velocity:
$response.setHeader("Cache-Control","max-age=60, public")
$response.setHeader("Pragma","-")
#set($expires = $util.getDate().getTime())
#set($expires = $expires+60000)
#set($expires =$util.getDate($expires))
$response.setDateHeader("Expires",$expires.getTime())
(the magic with the addition that has to take
place in set took me some time... ggrrrrr)
You could have used the
http://velocity.apache.org/tools/devel/generic/MathTool.html .
Paul, would be great to add this as a snippet on http:/extensions.xwiki.org ... :)
Thanks
-Vincent
Hope this helps,
Marius
>
> paul
>
>
> Le 14 mars 2011 à 18:23, Paul Libbrecht a écrit :
>
>> (moving to devs since it's an internal issue): the method
XWikiServletResponse.setHeader was calling addHeader.
>>
>>
http://jira.xwiki.org/jira/browse/XWIKI-6106 is opened.
>> (it concerns the trunk as well).
>>
>> Since I applied this fix on my development machine, I can set a cache-header!
>>
>> paul
>>
>>
>> Le 14 mars 2011 à 14:47, Paul Libbrecht a écrit :
>>> as I am slowly realizing, there's no way to prevent the output of the
following headers which basically say that no client or proxy caching should be done.
>>> I agree that the default policy should be to not cache but it should be
possible to allow to cache.
>>>
>>> Even changing the header values with:
>>> $response.setHeader("Cache-Control","max-age=60,
public")
>>> fails because it adds no-cache to the front.
>>>
>>> $reponse.setDateHeader("Expires",someDate) seems to work.
>>>
>>> This is quite odd I have to say.
>>> Should I hunt somewhere else?
>>> I fear I need to dig into the servlets.