开发者

JBoss/Tomcat/Struts2 Server Boot Point in Time?

I'm writing a web app in Struts2 that runs on a JBoss (or Tomcat).

I'd like to know when the server has started so I can use that point in time for caching purposes. In particular, I want to set the "Last-Modified" header to the time when the server last booted.

Any idea how to get this information within an action?开发者_JAVA技巧 I imagine that there must be some java code buried in e.g. Struts2 ready for this.

Thanks in advance!


A non-JBoss/Struts2 way to do this would be to create a Servlet configured to be initialized when the container starts up (via the load-on-startup tag in web.xml) and in that Servlet's init() methods save the current time (in Application Scope).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜