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


Java JacksonEncoder类代码示例

本文整理汇总了Java中feign.jackson.JacksonEncoder的典型用法代码示例。如果您正苦于以下问题:Java JacksonEncoder类的具体用法?Java JacksonEncoder怎么用?Java JacksonEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JacksonEncoder类属于feign.jackson包,在下文中一共展示了JacksonEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apiClient

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Produces
@Singleton
private ApiClient apiClient(Tracer tracer) {

    String host = config.getValue(APIGATEWAY_URL, String.class);
    String port = config.getValue(APIGATEWAY_PORT, String.class);

    log.infof("API gateway expected at %s:%s", host, port);

    return HystrixFeign.builder()
            .client(new TracingClient(new ApacheHttpClient(HttpClientBuilder.create().build()), tracer))
            .logger(new feign.Logger.ErrorLogger()).logLevel(feign.Logger.Level.BASIC)
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .target(ApiClient.class, String.format("http://%s:%s", host, port),
                    (LRA lra) -> rx.Observable.empty());

}
 
开发者ID:xstefank,项目名称:lra-service,代码行数:19,代码来源:BeanConfiguration.java

示例2: connect

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
static Retz connect(
        URI uri,
        Authenticator authenticator,
        SSLSocketFactory socketFactory,
        HostnameVerifier hostnameVerifier) {
    String url = Objects.requireNonNull(uri, "uri cannot be null").toString();
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new Jdk8Module());
    return Feign.builder()
            .client(new Client.Default(socketFactory, hostnameVerifier))
            .logger(new Slf4jLogger())
            .encoder(new JacksonEncoder(mapper))
            .decoder(new JacksonDecoder(mapper))
            .errorDecoder(new ErrorResponseDecoder(mapper))
            .requestInterceptor(new AuthHeaderInterceptor(authenticator))
            .target(Retz.class, url);
}
 
开发者ID:retz,项目名称:retz,代码行数:18,代码来源:Retz.java

示例3: create

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
public static NopCommerceClient create(String accessToken, String storeUrl)
    {
        // Prepare the request interceptors
        ArrayList<RequestInterceptor> requestInterceptors = new ArrayList<>();

        requestInterceptors.add(new OAuthRequestInterceptor(accessToken));
        requestInterceptors.add(new ContentTypeRequestInterceptor());

        // Set the connection and read timeouts to 2 minutes. In some nopCommerce websites
        // with a lot of data a request may take 1+ minute.
        Request.Options feignOptions = new Request.Options(120000, 120000);

        NopCommerceClient nopCommerceClient = Feign.builder()
                .decoder(new JacksonDecoder())
                .encoder(new JacksonEncoder())
//                .logger(new Logger.JavaLogger().appendToFile("http.log"))
//                .logLevel(Logger.Level.FULL)
                .requestInterceptors(requestInterceptors)
                .options(feignOptions)
                .target(NopCommerceClient.class, storeUrl);

        return nopCommerceClient;
    }
 
开发者ID:SevenSpikes,项目名称:nopcommerce-api-java-wrapper,代码行数:24,代码来源:NopCommerceFactory.java

示例4: create

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
public static ShopifyApiClient create(String accessToken, String myShopifyUrl, String nodeAddress)
    {
        ShopifyRedissonManager shopifyRedissonManager = new ShopifyRedissonManager(nodeAddress, myShopifyUrl);

        // Prepare the request interceptors
        ArrayList<RequestInterceptor> requestInterceptors = new ArrayList<>();

        requestInterceptors.add(new OAuthRequestInterceptor(accessToken));
        requestInterceptors.add(new ContentTypeRequestInterceptor());
        requestInterceptors.add(new RequestLimitInterceptor(shopifyRedissonManager));

        return Feign.builder()
                .decoder(new ShopifyJacksonDecoder(shopifyRedissonManager))
                .encoder(new JacksonEncoder())
                .requestInterceptors(requestInterceptors)
//                .logger(new Logger.JavaLogger().appendToFile("http.log"))
//                .logLevel(Logger.Level.FULL)
                .target(ShopifyApiClient.class, myShopifyUrl);
    }
 
开发者ID:SevenSpikes,项目名称:shopify-api-java-wrapper,代码行数:20,代码来源:ShopifyApiFactory.java

示例5: BackendServiceFactory

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Inject
public BackendServiceFactory(InjectionManager serviceLocator) {
	awsLambdaClient = new AWSLambdaClient();
	awsLambdaClient.configureRegion(BACKEND_SERVICE_REGION);
	backendService = Feign.builder()
			.client(FeignLambdaServiceInvokerClient.builder()
					.setRegion(BACKEND_SERVICE_REGION)
					.setFunctionName(BACKEND_SERVICE_FUNCTION_NAME)
					.build())
			.decoder(new JacksonDecoder())
			.encoder(new JacksonEncoder())
			.logger(new Slf4jLogger())
			.target(new LambdaServiceFunctionTarget<BackendService>(BackendService.class) {
				@Override
				public Request apply(RequestTemplate input) {
					// TODO inject the context directly => requires the context to be bound as proxy
					Context lambdaContext = serviceLocator.getInstance(Context.class);
					// propagate the AWS request ID => the called service can log the original AWS request ID
					input.header("X-Base-Aws-Request-Id", lambdaContext.getAwsRequestId());
					return super.apply(input);
				}
			});
}
 
开发者ID:bbilger,项目名称:jrestless-examples,代码行数:24,代码来源:BackendServiceFactory.java

示例6: publish

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Asynchronous
public void publish(final Event event) {
    if (BASE_URL == null || BASE_URL.isEmpty()) {
        logger.hawkularServerNotConfigured();
        return;
    }

    if (USERNAME == null || USERNAME.isEmpty()) {
        logger.hawkularServerUsernameNotConfigured();
        return;
    }

    if (PASSWORD == null || PASSWORD.isEmpty()) {
        logger.hawkularServerPasswordNotConfigured();
        return;
    }

    HystrixFeign.builder()
            .requestInterceptor(new BasicAuthRequestInterceptor(USERNAME, PASSWORD))
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .retryer(new Retryer.Default())
            .target(AlertsService.class, TARGET)
            .addEvent(event);
}
 
开发者ID:hawkular,项目名称:hawkular-apm,代码行数:26,代码来源:AlertsPublisher.java

示例7: createClient

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
private FleetApi createClient() {
    Feign.Builder builder = Feign.builder();
    if (client != null) {
        builder.client(client);
    }
    //@formatter:off
    builder.contract(new JAXRSModule.JAXRSContract())
            .decoder(new JacksonDecoder())
            .encoder(new JacksonEncoder())
            .errorDecoder(new FleetErrorDecoder())
            .requestInterceptors(getRequestInterceptors())
            .target(FleetApi.class, url);
    //@formatter:on
    return builder.target(FleetApi.class, url);

}
 
开发者ID:bolcom,项目名称:fleet-java-api,代码行数:17,代码来源:FleetClient.java

示例8: simpleFeignBuilder

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
public static HystrixFeign.Builder simpleFeignBuilder() {
    JacksonDecoder decoder = new JacksonDecoder(defaultObjectMapper);
    return HystrixFeign.builder()
            .setterFactory(new DefaultSetterFactory())
            .logger(new Slf4jLogger())
            .logLevel(Logger.Level.FULL)
            .retryer(new Retryer.Default())
            .contract(new Contract.Default())
            .client(new OkHttpClient())
            .options(new Request.Options())
            .encoder(new JacksonEncoder(defaultObjectMapper))
            .decoder(decoder)
            .errorDecoder(new AccessApiErrorDecoder(decoder));
}
 
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:15,代码来源:Clients.java

示例9: connect

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
/**
 * Constructs ready-to use client
 *
 * @param uri base uri
 * @return instance of api class
 */
static TicketApi connect(String uri) {
    ObjectMapper mapper = new ObjectMapper()
            .disable(FAIL_ON_UNKNOWN_PROPERTIES);

    return Feign.builder()
            .decoder(new JacksonDecoder(mapper))
            .encoder(new JacksonEncoder(mapper))
            .logger(new Slf4jLogger(TicketApi.class))
            .logLevel(Logger.Level.FULL)
            .target(TicketApi.class, uri);
}
 
开发者ID:lanwen,项目名称:wiremock-junit5,代码行数:18,代码来源:TicketApi.java

示例10: apiSetup

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Before
public void apiSetup() {
    this.api = Feign.builder()
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .logLevel(Logger.Level.BASIC)
            .target(OrderApi.class, "http://localhost:" + port);
}
 
开发者ID:roybailey,项目名称:research-graphql,代码行数:9,代码来源:OrderControllerTest.java

示例11: apiSetup

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Before
public void apiSetup() {
    this.api = Feign.builder()
            .encoder(new JacksonEncoder(jacksonMapper))
            .decoder(new JacksonDecoder(jacksonMapper))
            .logLevel(Logger.Level.BASIC)
            .target(UserApi.class, "http://localhost:"+port);
}
 
开发者ID:roybailey,项目名称:research-graphql,代码行数:9,代码来源:UserControllerTest.java

示例12: apiSetup

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Before
public void apiSetup() {
    this.api = Feign.builder()
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .logLevel(Logger.Level.BASIC)
            .target(ProductApi.class, "http://localhost:" + port);
}
 
开发者ID:roybailey,项目名称:research-graphql,代码行数:9,代码来源:ProductControllerTest.java

示例13: apiSetup

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@PostConstruct
public void apiSetup() {
    log.info("Connecting {} to {}", OrderApi.class.getSimpleName(), properties.getUrlOrderService());
    this.api = Feign.builder()
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .logLevel(Logger.Level.BASIC)
            .target(OrderApi.class, properties.getUrlOrderService());
}
 
开发者ID:roybailey,项目名称:research-graphql,代码行数:10,代码来源:OrderAdaptor.java

示例14: apiSetup

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@PostConstruct
public void apiSetup() {
    log.info("Connecting {} to {}", UserApi.class.getSimpleName(), properties.getUrlUserService());
    this.api = Feign.builder()
            .encoder(new JacksonEncoder(jacksonMapper))
            .decoder(new JacksonDecoder(jacksonMapper))
            .logLevel(Logger.Level.BASIC)
            .target(UserApi.class, properties.getUrlUserService());
}
 
开发者ID:roybailey,项目名称:research-graphql,代码行数:10,代码来源:UserAdaptor.java

示例15: apiSetup

import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@PostConstruct
public void apiSetup() {
    log.info("Connecting {} to {}", ProductApi.class.getSimpleName(), properties.getUrlProductService());
    this.api = Feign.builder()
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .logLevel(Logger.Level.BASIC)
            .target(ProductApi.class, properties.getUrlProductService());
}
 
开发者ID:roybailey,项目名称:research-graphql,代码行数:10,代码来源:ProductAdaptor.java


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