java.net.URLConnection.getUseCaches()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中java.net.URLConnection.getUseCaches()方法的一些代码示例,展示了URLConnection.getUseCaches()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URLConnection.getUseCaches()方法的具体详情如下:
包路径:java.net.URLConnection
类名称:URLConnection
方法名:getUseCaches

URLConnection.getUseCaches介绍

[英]Returns the value of the flag which specifies whether this URLConnection allows to use caches.
[中]返回标志的值,该标志指定此URLConnection是否允许使用缓存。

代码示例

代码示例来源:origin: robovm/robovm

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: mulesoft/mule

/**
 * Test to validate that we DO set useCache to false when loading resources from application, plugins as this could generate
 * file descriptor leaks once the application is undeployed.
 */
@Test
public void useCacheSetToFalseForJarUrlConnection() throws Exception {
 URLClassLoader parent = new URLClassLoader(new URL[0], Thread.currentThread().getContextClassLoader());
 final ClassLoaderLookupPolicy lookupPolicy = mock(ClassLoaderLookupPolicy.class);
 when(lookupPolicy.getClassLookupStrategy(TEST_CLASS_NAME)).thenReturn(CHILD_ONLY);
 FineGrainedControlClassLoader ext =
   new FineGrainedControlClassLoader(new URL[] {getChildFileResource()}, parent, lookupPolicy);
 URL url = ext.getResource(TEST_CLASS_PACKAGE);
 assertThat(url.openConnection().getUseCaches(), is(false));
}

代码示例来源:origin: org.eclipse.jetty.osgi/jetty-osgi-boot-warurl

@Override
public boolean getUseCaches()
{
  return _conn.getUseCaches();
}

代码示例来源:origin: MobiVM/robovm

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: org.jboss/jboss-common-core

public boolean getUseCaches() {
 return delegateConnection.getUseCaches();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: com.bugvm/bugvm-rt

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: ibinti/bugvm

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: FlexoVM/flexovm

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: com.gluonhq/robovm-rt

@Override
public boolean getUseCaches() {
  return jarFileURLConnection.getUseCaches();
}

代码示例来源:origin: org.samba.jcifs/jcifs

public boolean getUseCaches() {
  return connection.getUseCaches();
}

代码示例来源:origin: freeplane/freeplane

public boolean getUseCaches() {
  return connection.getUseCaches();
}

代码示例来源:origin: javaee/metro-jax-ws

if (conn.getUseCaches()) {
  doReset = true;
  conn.setDefaultUseCaches(false);

代码示例来源:origin: javaee/metro-jax-ws

if (conn.getUseCaches()) {
  doReset = true;
  conn.setDefaultUseCaches(false);

代码示例来源:origin: com.sun.xml.ws/jaxws-tools

if (conn.getUseCaches()) {
  doReset = true;
  conn.setDefaultUseCaches(false);

代码示例来源:origin: org.glassfish.metro/webservices-tools

if (conn.getUseCaches()) {
  doReset = true;
  conn.setDefaultUseCaches(false);

代码示例来源:origin: Countly/countly-sdk-android

public void testUrlConnectionForEventData() throws IOException {
  final String eventData = "blahblahblah";
  final URLConnection urlConnection = connectionProcessor.urlConnectionForEventData(eventData);
  assertEquals(30000, urlConnection.getConnectTimeout());
  assertEquals(30000, urlConnection.getReadTimeout());
  assertFalse(urlConnection.getUseCaches());
  assertTrue(urlConnection.getDoInput());
  assertFalse(urlConnection.getDoOutput());
  assertEquals(new URL(connectionProcessor.getServerURL() + "/i?" + eventData + "&checksum=" + sha1Hash(eventData + null)), urlConnection.getURL());
}

相关文章

URLConnection类方法