java.lang.Object
com.aoapps.servlet.ServletContextCache
ServletContext methods can be somewhat slow, this offers a cache that refreshes
the recently used values in the background. Importantly, it caches misses as well.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ServletContextCachegetCache(ServletContext servletContext) Deprecated.static ServletContextCachegetInstance(ServletContext servletContext) Gets or creates the cache for the provided servlet context.longgetLastModified(String path) Gets a modified time from either a file or URL.static longgetLastModified(ServletContext servletContext, String path) getRealPath(String path) static StringgetRealPath(ServletContext servletContext, String path) getResource(String path) Gets the possibly cached URL.static URLgetResource(ServletContext servletContext, String path)
-
Method Details
-
getInstance
Gets or creates the cache for the provided servlet context. -
getCache
Deprecated.Please usegetInstance(javax.servlet.ServletContext). -
getResource
Gets the possibly cached URL. This URL is not copied and caller should not fiddle with its state. Thank you Java for this not being immutable.- Throws:
MalformedURLException- See Also:
-
getResource
public static URL getResource(ServletContext servletContext, String path) throws MalformedURLException - Throws:
MalformedURLException- See Also:
-
getRealPath
- See Also:
-
getRealPath
- See Also:
-
getLastModified
Gets a modified time from either a file or URL.- Returns:
- The modified time or
0Lwhen not known - See Also:
-
getLastModified
- See Also:
-

getInstance(javax.servlet.ServletContext).