java.lang.Object | |
↳ | java.net.ResponseCache |
Caches URLConnection
responses.
The system's default cache can be set using setDefault(ResponseCache)
.
If getUseCaches()
returns true, URLConnection
will use the
default response cache, if one has been set.
Although URLConnection
will always call put(URI, URLConnection)
, the specific
ResponseCache
implementation gets to decide what will actually be cached,
and for how long.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the cached response corresponding to the given request.
| |||||||||||
Returns the system's default response cache, or null.
| |||||||||||
Allows the protocol handler to cache data after retrieving resources.
| |||||||||||
Sets the system's default response cache.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Returns the cached response corresponding to the given request.
uri | the request URI. |
---|---|
requestMethod | the request method. |
requestHeaders | a map of request headers. |
CacheResponse
object if the request is available in the cache
or null
otherwise.IOException | if an I/O error occurs while getting the cached data. |
---|---|
IllegalArgumentException | if any one of the parameters is set to null .
|
Returns the system's default response cache, or null.
Allows the protocol handler to cache data after retrieving resources. The
ResponseCache
decides whether the resource data should be cached
or not. If so, this method returns a CacheRequest
to write the
resource data to. Otherwise, this method returns null
.
uri | the reference to the requested resource. |
---|---|
conn | the connection to fetch the response. |
null
otherwise.IOException | if an I/O error occurs while adding the resource. |
---|---|
IllegalArgumentException | if any one of the parameters is set to null .
|
Sets the system's default response cache. Use null to remove the response cache.