feign.Feign.Builder Java Examples

The following examples show how to use feign.Feign.Builder. 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: MarathonClient.java    From marathon-client with Apache License 2.0 7 votes vote down vote up
/**
 * The generalized version of the method that allows more in-depth customizations via
 * {@link RequestInterceptor}s.
 *
 * @param endpoint
 * 		URL of Marathon
 * @param interceptors optional request interceptors
 * @return Marathon client
 */
public static Marathon getInstance(String endpoint, RequestInterceptor... interceptors) {

	Builder b = Feign.builder()
			.encoder(new GsonEncoder(ModelUtils.GSON))
			.decoder(new GsonDecoder(ModelUtils.GSON))
			.errorDecoder(new MarathonErrorDecoder());
	if (interceptors != null)
		b.requestInterceptors(asList(interceptors));
	String debugOutput = System.getenv(DEBUG_JSON_OUTPUT);
	if ("System.out".equals(debugOutput)) {
		System.setProperty("org.slf4j.simpleLogger.logFile", "System.out");
		System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug");
		b.logger(new Slf4jLogger()).logLevel(Logger.Level.FULL);
	} else if (debugOutput != null) {
		b.logger(new Logger.JavaLogger().appendToFile(debugOutput)).logLevel(Logger.Level.FULL);
	}
	b.requestInterceptor(new MarathonHeadersInterceptor());
	return b.target(Marathon.class, endpoint);
}
 
Example #2
Source File: ChronosClient.java    From spring-cloud-deployer-mesos with Apache License 2.0 5 votes vote down vote up
/**
 * The generalized version of the method that allows more in-depth customizations via
 * {@link RequestInterceptor}s.
 *
 * @param endpoint URL for Chronos API
 */
public static Chronos getInstance(String endpoint, RequestInterceptor... interceptors) {
	Builder b = Feign.builder()
			.encoder(new GsonEncoder(AbstractModel.GSON))
			.decoder(new MultiDecoder())
			.errorDecoder(new ChronosErrorDecoder());
	if (interceptors != null) {
		b.requestInterceptors(asList(interceptors));
	}
	b.requestInterceptor(new ChronosHeadersInterceptor());
	return b.target(Chronos.class, endpoint);
}
 
Example #3
Source File: ExtTargeter.java    From onetwo with Apache License 2.0 5 votes vote down vote up
public FeignTargetContext(FeignClientFactoryBean feignClientfactory, Builder feign, FeignContext context,
		HardCodedTarget<T> hardeCodetarget, Targeter cloudTargeter) {
	super();
	this.feignClientfactory = feignClientfactory;
	this.feign = feign;
	this.context = context;
	this.hardeCodetarget = hardeCodetarget;
	this.cloudTargeter = cloudTargeter;
}
 
Example #4
Source File: HystrixFeignBuilder.java    From onetwo with Apache License 2.0 4 votes vote down vote up
@Override
public Builder decode404() {
  return (Builder) super.decode404();
}
 
Example #5
Source File: GoogleHttpClientTest.java    From feign with Apache License 2.0 4 votes vote down vote up
@Override
public Builder newBuilder() {
  return Feign.builder()
      .client(new GoogleHttpClient());
}
 
Example #6
Source File: ApacheHttpClientTest.java    From feign with Apache License 2.0 4 votes vote down vote up
@Override
public Builder newBuilder() {
  return Feign.builder().client(new ApacheHttpClient());
}
 
Example #7
Source File: ApacheHttp5ClientTest.java    From feign with Apache License 2.0 4 votes vote down vote up
@Override
public Builder newBuilder() {
  return Feign.builder().client(new ApacheHttp5Client());
}
 
Example #8
Source File: OkHttpClientTest.java    From feign with Apache License 2.0 4 votes vote down vote up
@Override
public Builder newBuilder() {
  return Feign.builder().client(new OkHttpClient());
}
 
Example #9
Source File: JAXRSClientTest.java    From feign with Apache License 2.0 4 votes vote down vote up
@Override
public Builder newBuilder() {
  return Feign.builder().client(new JAXRSClient());
}
 
Example #10
Source File: DefaultClientTest.java    From feign with Apache License 2.0 4 votes vote down vote up
@Override
public Builder newBuilder() {
  return Feign.builder().client(new Client.Default(TrustingSSLSocketFactory.get(), null, false));
}
 
Example #11
Source File: AbstractClientTest.java    From feign with Apache License 2.0 2 votes vote down vote up
/**
 * Create a Feign {@link Builder} with a client configured
 */
public abstract Builder newBuilder();