当前位置: 首页>>代码示例>>Java>>正文


Java HttpResponseCache类代码示例

本文整理汇总了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;
		}		
		
	}
 
开发者ID:helderm,项目名称:songseeker,代码行数:20,代码来源:FileCache.java

示例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();
}
 
开发者ID:helderm,项目名称:songseeker,代码行数:10,代码来源:MainActivity.java

示例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();
}
 
开发者ID:helderm,项目名称:songseeker,代码行数:15,代码来源:MainActivity.java

示例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() );
  }
}
 
开发者ID:icoretech,项目名称:audiobox-jlib,代码行数:39,代码来源:AudioBoxIntegrationTests.java

示例5: onStop

import com.integralblue.httpresponsecache.HttpResponseCache; //导入依赖的package包/类
@Override
protected void onStop() {
    HttpResponseCache cache = HttpResponseCache.getInstalled();
    if (cache != null) {
        cache.flush();
    }
    super.onStop();
}
 
开发者ID:mcilloni,项目名称:NerdzMessenger,代码行数:9,代码来源:ConversationActivity.java

示例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() );
  }
}
 
开发者ID:icoretech,项目名称:audiobox-jlib,代码行数:45,代码来源:AudioBoxTests.java


注:本文中的com.integralblue.httpresponsecache.HttpResponseCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。