org.jdesktop.swingx.mapviewer
Class LocalResponseCache

java.lang.Object
  extended by java.net.ResponseCache
      extended by org.jdesktop.swingx.mapviewer.LocalResponseCache

public class LocalResponseCache
extends ResponseCache


Field Summary
static File CHACHE_DIR
           
static boolean IS_CACHE_DISABLED
           
 
Method Summary
 CacheResponse get(URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders)
          Retrieve the cached response based on the requesting uri, request method and request headers.
static File getLocalFile(URI remoteUri)
          Returns the local File corresponding to the given remote URI.
static void installResponseCache()
           
 CacheRequest put(URI uri, URLConnection conn)
          The protocol handler calls this method after a resource has been retrieved, and the ResponseCache must decide whether or not to store the resource in its cache.
 
Methods inherited from class java.net.ResponseCache
getDefault, setDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_CACHE_DISABLED

public static final boolean IS_CACHE_DISABLED
See Also:
Constant Field Values

CHACHE_DIR

public static final File CHACHE_DIR
Method Detail

installResponseCache

public static void installResponseCache()

getLocalFile

public static File getLocalFile(URI remoteUri)
Returns the local File corresponding to the given remote URI.


get

public CacheResponse get(URI uri,
                         String rqstMethod,
                         Map<String,List<String>> rqstHeaders)
                  throws IOException
Description copied from class: java.net.ResponseCache
Retrieve the cached response based on the requesting uri, request method and request headers. Typically this method is called by the protocol handler before it sends out the request to get the network resource. If a cached response is returned, that resource is used instead.

Specified by:
get in class ResponseCache
Parameters:
uri - a URI used to reference the requested network resource
rqstMethod - a String representing the request method
rqstHeaders - - a Map from request header field names to lists of field values representing the current request headers
Returns:
a CacheResponse instance if available from cache, or null otherwise
Throws:
IOException - if an I/O error occurs
See Also:
URLConnection.setUseCaches(boolean), URLConnection.getUseCaches(), URLConnection.setDefaultUseCaches(boolean), URLConnection.getDefaultUseCaches()

put

public CacheRequest put(URI uri,
                        URLConnection conn)
                 throws IOException
Description copied from class: java.net.ResponseCache
The protocol handler calls this method after a resource has been retrieved, and the ResponseCache must decide whether or not to store the resource in its cache. If the resource is to be cached, then put() must return a CacheRequest object which contains a WriteableByteChannel that the protocol handler will use to write the resource into the cache. If the resource is not to be cached, then put must return null.

Specified by:
put in class ResponseCache
Parameters:
uri - a URI used to reference the requested network resource
conn - - a URLConnection instance that is used to fetch the response to be cached
Returns:
a CacheRequest for recording the response to be cached. Null return indicates that the caller does not intend to cache the response.
Throws:
IOException - if an I/O error occurs