All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.webpieces.httpproxy.impl.HttpProxyFactoryImpl Maven / Gradle / Ivy

Go to download

Someone forgot to fill this in. See http://stackoverflow.com/questions/38272550/how-to-fail-the-gradle-build-if-subproject-is-missing-a-property

The newest version!
package org.webpieces.httpproxy.impl;

import org.webpieces.httpproxy.api.HttpProxy;
import org.webpieces.httpproxy.api.HttpProxyFactory;
import org.webpieces.httpproxy.api.ProxyConfig;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.util.Modules;

public class HttpProxyFactoryImpl extends HttpProxyFactory {

	@Override
	protected HttpProxy createHttpProxyImpl(String id, Module overrideModule, ProxyConfig config) {
		Module testModule = overrideModule;
		
		Module allModules = getModules(config);
		if(testModule != null) 
			allModules = Modules.override(allModules).with(testModule);
		Injector injector = Guice.createInjector(allModules);
		return injector.getInstance(HttpProxy.class);
	}

	private Module getModules(ProxyConfig config) {
		return Modules.combine(
			new HttpProxyModule(config)
		);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy