org.apache.catalina.webresources.TomcatURLStreamHandlerFactory Java Examples

The following examples show how to use org.apache.catalina.webresources.TomcatURLStreamHandlerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest.java    From spring-cloud-netflix with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void contextFailsWithoutWebClient() {

	ConfigurableApplicationContext ctx = null;
	try {
		TomcatURLStreamHandlerFactory.disable();
		ctx = new SpringApplicationBuilder(EurekaSampleApplication.class)
				.properties("eureka.client.webclient.enabled=true").run();
		fail("exception not thrown");
	}
	catch (Exception e) {
		// this is the desired state
		assertThat(e).hasMessageContaining("WebClient is not on the classpath");
	}
	if (ctx != null) {
		ctx.close();
	}
}
 
Example #2
Source File: WebappClassLoaderBase.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Clear references.
 */
protected void clearReferences() {

    // De-register any remaining JDBC drivers
    clearReferencesJdbc();

    // Stop any threads the web application started
    clearReferencesThreads();

    // Clear any references retained in the serialization caches
    if (clearReferencesObjectStreamClassCaches) {
        clearReferencesObjectStreamClassCaches();
    }

    // Check for leaks triggered by ThreadLocals loaded by this class loader
    if (clearReferencesThreadLocals) {
        checkThreadLocalsForLeaks();
    }

    // Clear RMI Targets loaded by this class loader
    if (clearReferencesRmiTargets) {
        clearReferencesRmiTargets();
    }

     // Clear the IntrospectionUtils cache.
    IntrospectionUtils.clear();

    // Clear the classloader reference in common-logging
    if (clearReferencesLogFactoryRelease) {
        org.apache.juli.logging.LogFactory.release(this);
    }

    // Clear the classloader reference in the VM's bean introspector
    java.beans.Introspector.flushCaches();

    // Clear any custom URLStreamHandlers
    TomcatURLStreamHandlerFactory.release(this);
}
 
Example #3
Source File: EurekaConfigServerBootstrapConfigurationTests.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Test
public void eurekaConfigServerInstanceProviderCalled() {
	// FIXME: why do I need to do this? (fails in maven build without it.
	TomcatURLStreamHandlerFactory.disable();
	new SpringApplicationBuilder(TestConfigDiscoveryConfiguration.class).properties(
			"spring.cloud.config.discovery.enabled=true",
			"spring.main.sources="
					+ TestConfigDiscoveryBootstrapConfiguration.class.getName(),
			"logging.level.org.springframework.cloud.netflix.eureka.config=DEBUG")
			.run();
	assertThat(output).contains(
			"eurekaConfigServerInstanceProvider finding instances for configserver")
			.contains(
					"eurekaConfigServerInstanceProvider found 1 instance(s) for configserver");
}
 
Example #4
Source File: TestHandler.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Before
public void register() {
    TomcatURLStreamHandlerFactory.register();
}
 
Example #5
Source File: TestWarURLConnection.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Before
public void register() {
    TomcatURLStreamHandlerFactory.register();
}
 
Example #6
Source File: TestAbstractInputStreamJar.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Before
public void register() {
    TomcatURLStreamHandlerFactory.register();
}
 
Example #7
Source File: TestConfigFileLoader.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@BeforeClass
public static void setup() {
    TomcatURLStreamHandlerFactory.getInstance();
    System.setProperty("catalina.base", "");
}
 
Example #8
Source File: TesterUriUtilBase.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
protected TesterUriUtilBase(String separator) {
    this.separator = separator;
    TomcatURLStreamHandlerFactory.register();
    System.setProperty("org.apache.tomcat.util.buf.UriUtil.WAR_SEPARATOR", separator);
}
 
Example #9
Source File: Application.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
  // Avoid resetting URL stream handler factory
  TomcatURLStreamHandlerFactory.disable();

  SpringApplication.run(Application.class, args);
}
 
Example #10
Source File: DiscoveryClientConfigServiceAutoConfigurationTests.java    From spring-cloud-consul with Apache License 2.0 4 votes vote down vote up
@Before
public void init() {
	// FIXME: why do I need to do this? (fails in maven build without it.
	TomcatURLStreamHandlerFactory.disable();
}
 
Example #11
Source File: Application.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
  // Avoid resetting URL stream handler factory
  TomcatURLStreamHandlerFactory.disable();

  SpringApplication.run(Application.class, args);
}