Search in sources :

Example 1 with Netty4ClientHttpRequestFactory

use of org.springframework.http.client.Netty4ClientHttpRequestFactory in project paascloud-master by paascloud.

the class OAuth2FeignAutoConfiguration method oAuth2RestTemplate.

/**
 * O auth 2 rest template o auth 2 rest template.
 *
 * @return the o auth 2 rest template
 */
@Bean("paascloudOAuth2RestTemplate")
public OAuth2RestTemplate oAuth2RestTemplate() {
    final OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(resourceDetails(), new DefaultOAuth2ClientContext());
    oAuth2RestTemplate.setRequestFactory(new Netty4ClientHttpRequestFactory());
    return oAuth2RestTemplate;
}
Also used : DefaultOAuth2ClientContext(org.springframework.security.oauth2.client.DefaultOAuth2ClientContext) Netty4ClientHttpRequestFactory(org.springframework.http.client.Netty4ClientHttpRequestFactory) OAuth2RestTemplate(org.springframework.security.oauth2.client.OAuth2RestTemplate) Bean(org.springframework.context.annotation.Bean)

Example 2 with Netty4ClientHttpRequestFactory

use of org.springframework.http.client.Netty4ClientHttpRequestFactory in project pinpoint by naver.

the class RestTemplateIT method test3.

@Test
public void test3() throws Exception {
    RestTemplate restTemplate = new RestTemplate(new Netty4ClientHttpRequestFactory());
    String forObject = restTemplate.getForObject(getCallUrl(), String.class);
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.awaitTrace(event("ASYNC", "Asynchronous Invocation"), 20, 3000);
    verifier.printCache();
    verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor()));
    verifier.verifyTrace(event("REST_TEMPLATE", "org.springframework.http.client.AbstractAsyncClientHttpRequest.executeAsync()"));
    verifier.verifyTrace(event("REST_TEMPLATE", "RestTemplate execAsync Result Invocation"));
    verifier.verifyTrace(event("ASYNC", "Asynchronous Invocation"));
    verifier.verifyTrace(event("REST_TEMPLATE", "org.springframework.util.concurrent.SettableListenableFuture.set(java.lang.Object)", annotation("http.status.code", 200)));
}
Also used : RestTemplate(org.springframework.web.client.RestTemplate) Netty4ClientHttpRequestFactory(org.springframework.http.client.Netty4ClientHttpRequestFactory) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Aggregations

Netty4ClientHttpRequestFactory (org.springframework.http.client.Netty4ClientHttpRequestFactory)2 PluginTestVerifier (com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)1 Test (org.junit.Test)1 Bean (org.springframework.context.annotation.Bean)1 DefaultOAuth2ClientContext (org.springframework.security.oauth2.client.DefaultOAuth2ClientContext)1 OAuth2RestTemplate (org.springframework.security.oauth2.client.OAuth2RestTemplate)1 RestTemplate (org.springframework.web.client.RestTemplate)1