本文整理汇总了Java中com.integralblue.httpresponsecache.HttpResponseCache类的典型用法代码示例。如果您正苦于以下问题:Java HttpResponseCache类的具体用法?Java HttpResponseCache怎么用?Java HttpResponseCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpResponseCache类属于com.integralblue.httpresponsecache包,在下文中一共展示了HttpResponseCache类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clear
import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
public void clear(Context c){
try {
if(imageCache != null){
imageCache.delete();
}
HttpResponseCache httpCache = com.integralblue.httpresponsecache.HttpResponseCache.getInstalled();
if(httpCache != null)
httpCache.delete();
install(c);
} catch (IOException e) {
Log.e(Util.APP, "Failed to destroy the Http Cache", e);
return;
}
}
示例2: onStop
import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
@Override
protected void onStop() {
HttpResponseCache httpCache = com.integralblue.httpresponsecache.HttpResponseCache.getInstalled();
if(httpCache != null){
httpCache.flush();
}
super.onStop();
}
示例3: onDestroy
import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
@Override
protected void onDestroy() {
try{
HttpResponseCache httpCache = com.integralblue.httpresponsecache.HttpResponseCache.getInstalled();
if(httpCache != null){
httpCache.delete();
}
}catch(Exception e){
Log.e(Util.APP, "Unable to delete http cache", e);
}
super.onDestroy();
}
示例4: setUp
import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
/**
* Sets up.
*/
@Before
public void setUp() {
// Remove existing handlers attached to j.u.l root logger
SLF4JBridgeHandler.removeHandlersForRootLogger();
// add SLF4JBridgeHandler to j.u.l's root logger
SLF4JBridgeHandler.install();
printTimingLog = true;
time_start = System.currentTimeMillis();
logger.debug( "*** Tests started: " + name.getMethodName() );
try {
final long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
final File httpCacheDir = CACHE_DIR;
HttpResponseCache.install( httpCacheDir, httpCacheSize );
JacksonFactory jf = new JacksonFactory();
Configuration config = new Configuration( env )
.setCredentialDataStore( new FileCredentialStore( DATA_STORE_DIR ) )
.setApiKey( fixtures.getString( "authentication.client_id" ) )
.setApiSecret( fixtures.getString( "authentication.client_secret" ) )
.setHttpTransport( new NetHttpTransport() )
.setJsonFactory( jf );
CredentialRefreshListener crl = new DataStoreCredentialRefreshListener( AudioBoxClient.ACCOUNT_TOKENS, ( ( FileCredentialStore ) config.getCredentialDataStore() ).getDB() );
config.setCredentialRefreshListener( crl );
c = new AudioBoxClient( config );
} catch ( ConfigurationException | IOException e ) {
fail( e.getMessage() );
}
}
示例5: onStop
import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
@Override
protected void onStop() {
HttpResponseCache cache = HttpResponseCache.getInstalled();
if (cache != null) {
cache.flush();
}
super.onStop();
}
示例6: setUp
import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
/**
* Sets up.
*/
@Before
public void setUp() {
// Remove existing handlers attached to j.u.l root logger
SLF4JBridgeHandler.removeHandlersForRootLogger();
// add SLF4JBridgeHandler to j.u.l's root logger
SLF4JBridgeHandler.install();
printTimingLog = true;
time_start = System.currentTimeMillis();
logger.debug( "*** Tests started: " + name.getMethodName() );
try {
final long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
final File httpCacheDir = CACHE_DIR;
HttpResponseCache.install( httpCacheDir, httpCacheSize );
JacksonFactory jf = new JacksonFactory();
Configuration config = new Configuration()
.setCredentialDataStore( new MemoryCredentialStore() )
.setApiKey( fixtures.getString( "authentication.client_id" ) )
.setApiSecret( fixtures.getString( "authentication.client_secret" ) )
.setHttpTransport( MockHttp.getTransport() )
.setJsonFactory( jf )
.setApplicationName( "Tests" )
.setVersion( "1.0" );
CredentialRefreshListener crl = new DataStoreCredentialRefreshListener( AudioBoxClient.ACCOUNT_TOKENS, config.getCredentialDataStore().getDB());
config.setCredentialRefreshListener( crl );
config.setEnvironment( env );
c = new AudioBoxClient( config );
assertNotNull(c);
} catch ( ConfigurationException | IOException e ) {
fail( e.getMessage() );
}
}