public abstract class ResponseCache extends Object
Constructor and Description |
---|
ResponseCache() |
Modifier and Type | Method and Description |
---|---|
abstract CacheResponse |
get(URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders)
检索缓存的响应基于请求的URI请求方法、请求报头。
|
static ResponseCache |
getDefault()
获取系统宽响应缓存。
|
abstract CacheRequest |
put(URI uri, URLConnection conn)
协议处理程序调用此方法后,资源已被检索,和responsecache必须决定是否存储在缓存中的资源。
|
static void |
setDefault(ResponseCache responseCache)
集(或设定)全系统缓存。
|
public static ResponseCache getDefault()
ResponseCache
SecurityException
如果安全管理器已经安装,它否认
NetPermission
("getResponseCache")
setDefault(ResponseCache)
public static void setDefault(ResponseCache responseCache)
responseCache
-响应缓存,或
null
未设置缓存。
SecurityException
如果安全管理器已经安装,它否认
NetPermission
("setResponseCache")
getDefault()
public abstract CacheResponse get(URI uri, String rqstMethod, Map<String,List<String>> rqstHeaders) throws IOException
uri
-用来请求网络资源参考
URI
rqstMethod
-
String
表示请求的方法
rqstHeaders
-Map从请求标头字段名称列表的字段的值表示当前请求报头
CacheResponse
如果可以从缓存,或空否则
IOException
如果I/O错误发生
IllegalArgumentException
-如果参数的任何一个是空的
URLConnection.setUseCaches(boolean)
,
URLConnection.getUseCaches()
,
URLConnection.setDefaultUseCaches(boolean)
,
URLConnection.getDefaultUseCaches()
public abstract CacheRequest put(URI uri, URLConnection conn) throws IOException
uri
-用来请求网络资源参考
URI
conn
--一个URLConnection实例,用于获取被缓存的响应
CacheRequest
。返回值指示调用方不打算缓存响应。
IOException
如果I/O错误发生
IllegalArgumentException
-如果参数的任何一个是空的
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.