Enable cache of J2EE web application's resources

為{幸葍}努か 提交于 2019-12-07 17:10:25

问题


How can I control my web application's resource handling?

I have users with extremely high latency times (~1s!) and I must test my application in such environments. What I can see right away is that my resources (css and image files) are always reloaded on every page, probably because the response header contains an Expire tag that does not allow for any browser caching.

How can I tell the ?resoure adapter? to set it to some reasonable value? Are there any other ways to improve bad latency effects?

Environment: Glassfish v3, JSF2 and Primefaces.


回答1:


I found this:

http://code.google.com/p/xebia-france/wiki/ExpiresFilter

it works, but not for security-enabled resources, where Glassfish sets the Expires header on its own.

This is another useful bit of information (the "Using Security Constraints..." section):

http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/ImageBundle.html

I will rephrase my question concerning Glassfish and resources.




回答2:


Thanks for your interest in ExpiresFilter Gabor, please note that ExpiresFilter has been integrated in Tomcat 7.0.2 ( http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Expires_Filter ).

Cyrille (Xebia)



来源:https://stackoverflow.com/questions/3371945/enable-cache-of-j2ee-web-applications-resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!