| java.lang.Object | |
| ↳ | java.net.ResponseCache |
ResponseCache implements URLConnection caches. System default cache can be
registered by invoking ResponseCache.setDefault(ResponseCache),
and can be retrieved by invoking ResponseCache.getDefault.
If URLConnection#useCaches is set, URLConnection class will
use ResponseCache to store and get resources. Whether the
resource is cached depends on ResponseCache implementation. If
a request resource is cached, protocol handler will fecth it from the cache.
If the protocol handler fails to get resource from the cache, it turns to get
the resource from its original location.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructor method.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Gets the cached response according to requesting uri,method and headers.
| |||||||||||
Gets system default response cache.
| |||||||||||
Protocol handler calls this method after retrieving resources.
| |||||||||||
Sets the system default response cache when responseCache is not null.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Constructor method.
Gets the cached response according to requesting uri,method and headers.
| uri | A URL represents requesting uri. |
|---|---|
| rqstMethod | A String represents requesting method. |
| rqstHeaders | A Map from request header field names to lists
of field values represents requesting headers. |
CacheResponse object if the request is available
in the cache. Otherwise, this method returns null.| IOException | If an I/O error is encountered. |
|---|---|
| IllegalArgumentException | If any one of the parameters is null |
Gets system default response cache.
ResponseCache.| SecurityException | If a security manager is installed and it doesn't have
NetPermission("getResponseCache").
|
|---|
Protocol handler calls this method after retrieving resources. The
ResponseCache decides whether the resource should be
cached. If the resource needs to be cached, this method will return a
CacheRequest with a WriteableByteChannel,
and then, protocol handler will use this channel to write the resource
data into the cache. Otherwise, if the resource doesn't need to be
cached, it returns null.
CacheRequest which contains
WriteableByteChannel if the resource is cached.
Otherwise, it returns null.| IOException | If an I/O error is encountered. |
|---|---|
| IllegalArgumentException | If any one of the parameters is null. |
Sets the system default response cache when responseCache is not null. Otherwise, the method unsets the system default response cache. This setting may be ignored by some non-standard protocols.
| responseCache | Set default ResponseCache. If responseCache is
null, it unsets the cache. |
|---|
| SecurityException | If a security manager is installed and it doesn't have
NetPermission("setResponseCache").
|
|---|