pearkes / gethub

A utility for cloning and fetching your remote git repositories from GitHub.
MIT License
217 stars 266 forks source link

implement caching in JSP #21

Closed kgandra closed 7 years ago

kgandra commented 7 years ago

JSP caching lets you cache tag invocation results within the Java engine. Each can be cached using different cache criteria. JSP caching is defined by following:

  1. Enabling JSP caching: To globally enable JSP caching, set the jspCachingEnabled property to true. The default is false. For Example

asadmin set server-config.web-container.property.jspCachingEnabled="true" To enable JSP caching for a single web application, follow these steps:

-Extract the META-INF/appserv-tags.tld file from the as-install/glassfish/modules/web-glue.jar file. -Create a new JAR file (for example, appserv-tags.jar) containing just the META-INF/appserv-tags.tld file previously extracted. -Bundle this new JAR file in the WEB-INF/lib directory of your web application.

  1. Caching Scope: JSP caching is available in three different scopes: request, session, and application. The default is application. To use a cache in request scope, a web application must specify the com.sun.appserv.web.taglibs.cache.CacheRequestListener in its web.xml deployment descriptor, as follows:
com.sun.appserv.web.taglibs.cache.CacheRequestListener 3. Cache Tag: The cache tag caches the body between the beginning and ending tags according to the attributes specified. The first time the tag is encountered; the body content is executed and cached. Each subsequent time it is run, the cached content is checked to see if it needs to be refreshed and if so, it is executed again, and the cached data is refreshed. Otherwise, the cached data is served. 4. Flush tag: Forces the cache to be flushed. If a key is specified, only the entry with that key is flushed. If no key is specified, the entire cache is flushed.