• Post Reply Bookmark Topic Watch Topic
  • New Topic

Syntax for relative expires header  RSS feed

 
Easwara Murthy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have to add an expires header to make the components in my web page cacheable.

The following meta tag can be used in JSP to achieve the same:
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2009 11:12:01 GMT">

In this syntax we have to specify the exact expiry time.
Is it possible to specify a relative expiry time.. something like "now plus 2 months" (I came to know that we can use ExpiresDefault "access plus 2 months" in Apache but can we achieve the same in meta tag)

Regards,
Easwara
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, relative times can not be used. But the SimpleDateFormat class makes it easy to format datetimes any way you want, so you can construct a Date or Calendar object for the expiration time, and then format it appropriately.
 
Easwara Murthy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dittmer
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!