本文整理汇总了Java中feign.jackson.JacksonEncoder类的典型用法代码示例。如果您正苦于以下问题:Java JacksonEncoder类的具体用法?Java JacksonEncoder怎么用?Java JacksonEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JacksonEncoder类属于feign.jackson包,在下文中一共展示了JacksonEncoder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: apiSetup
import feign.jackson.JacksonEncoder; //导入依赖的package包/类
<T> T apiSetup(Class<T> target) {
return Feign.builder()
.encoder(new JacksonEncoder(mapper))
.decoder(new JacksonDecoder())
.logLevel(Logger.Level.BASIC)
.target(target, "http://localhost:" + port);
}
开发者ID:roybailey,项目名称:research-graphql,代码行数:8,代码来源:AbstractControllerTestCase.java
示例17: getAuthenticationClient
import feign.jackson.JacksonEncoder; //导入依赖的package包/类
/**
* Returns a Feign client for the Symphony authentication REST endpoints. Reuses existing client if already
* built, otherwise builds and caches a new one.
* @param companyId ID of company/pod for which client is needed
* @return REST client for pod
* @throws IllegalStateException if no pod info is present for pod ID
*/
public AuthenticationClient getAuthenticationClient(String companyId) {
// Gets pod info from PodDirectory. This will throw IllegalStateException if no pod info is available for pod ID
PodInfo podInfo = podDirectory.getPodInfo(companyId);
final String podHost = podInfo.getPayload().getSessionAuthUrl();
// Return existing (or create, cache and return new instance)
return clients.computeIfAbsent(companyId, k -> Feign.builder()
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.client(okHttpClient)
.target(AuthenticationClient.class, podHost));
}
开发者ID:symphonyoss,项目名称:app-auth-example,代码行数:20,代码来源:SymphonyClientFactory.java
示例18: overwritesConfigOnShutdownAfterAddingFederation
import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Test
public void overwritesConfigOnShutdownAfterAddingFederation() throws Exception {
exit.expectSystemExitWithStatus(0);
runner = WaggleDanceRunner
.builder(configLocation)
.databaseResolution(DatabaseResolution.PREFIXED)
.primary("primary", localServer.getThriftConnectionUri(),
AccessControlType.READ_AND_WRITE_AND_CREATE_ON_DATABASE_WHITELIST)
.federate("waggle_remote", remoteServer.getThriftConnectionUri(), REMOTE_DATABASE)
.build();
runWaggleDance(runner);
FederationsAdminClient restClient = Feign
.builder()
.contract(new JAXRSContract())
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.target(FederationsAdminClient.class, "http://localhost:18000/");
FederatedMetaStore newFederation = new FederatedMetaStore("new_waggle_remote",
newRemoteServer.getThriftConnectionUri());
restClient.add(newFederation);
Federations federations = stopServerAndGetConfiguration();
List<FederatedMetaStore> federatedMetastores = federations.getFederatedMetaStores();
assertThat(federatedMetastores.size(), is(2));
FederatedMetaStore remoteMetastore = federatedMetastores.get(0);
assertThat(remoteMetastore.getName(), is("waggle_remote"));
assertThat(remoteMetastore.getMappedDatabases().size(), is(1));
assertThat(remoteMetastore.getMappedDatabases().get(0), is(REMOTE_DATABASE));
FederatedMetaStore newRemoteMetastore = federatedMetastores.get(1);
assertThat(newRemoteMetastore.getName(), is("new_waggle_remote"));
assertThat(newRemoteMetastore.getMappedDatabases().size(), is(0));
}
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:39,代码来源:WaggleDanceIntegrationTest.java
示例19: doesNotOverwriteConfigOnShutdownAfterAddingFederation
import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Test
public void doesNotOverwriteConfigOnShutdownAfterAddingFederation() throws Exception {
exit.expectSystemExitWithStatus(0);
runner = WaggleDanceRunner
.builder(configLocation)
.databaseResolution(DatabaseResolution.PREFIXED)
.overwriteConfigOnShutdown(false)
.primary("primary", localServer.getThriftConnectionUri(),
AccessControlType.READ_AND_WRITE_AND_CREATE_ON_DATABASE_WHITELIST)
.federate("waggle_remote", remoteServer.getThriftConnectionUri(), REMOTE_DATABASE)
.build();
runWaggleDance(runner);
FederationsAdminClient restClient = Feign
.builder()
.contract(new JAXRSContract())
.encoder(new JacksonEncoder())
.decoder(new JacksonDecoder())
.target(FederationsAdminClient.class, "http://localhost:18000/");
FederatedMetaStore newFederation = new FederatedMetaStore("new_waggle_remote",
newRemoteServer.getThriftConnectionUri());
restClient.add(newFederation);
Federations federations = stopServerAndGetConfiguration();
List<FederatedMetaStore> federatedMetastores = federations.getFederatedMetaStores();
assertThat(federatedMetastores.size(), is(1));
FederatedMetaStore remoteMetastore = federatedMetastores.get(0);
assertThat(remoteMetastore.getName(), is("waggle_remote"));
assertThat(remoteMetastore.getMappedDatabases().size(), is(1));
assertThat(remoteMetastore.getMappedDatabases().get(0), is(REMOTE_DATABASE));
}
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:36,代码来源:WaggleDanceIntegrationTest.java
示例20: tempoApiBuilder
import feign.jackson.JacksonEncoder; //导入依赖的package包/类
@Bean
public Feign.Builder tempoApiBuilder() {
final ObjectMapper objectMapper = createObjectMapper();
final JacksonDecoder decoder = new JacksonDecoder(objectMapper);
final JacksonEncoder encoder = new JacksonEncoder(objectMapper);
return Feign.builder()
.requestInterceptor(tempoApiAuthentication())
.errorDecoder(new TempoApiErrorDecoder(decoder))
.client(new ApacheHttpClient(httpClient))
.encoder(encoder)
.decoder(decoder)
.logger(new Slf4jLogger());
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:16,代码来源:TempoApiConfiguration.java
注:本文中的feign.jackson.JacksonEncoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论