Java 类org.springframework.http.client.AbstractClientHttpRequest 实例源码

项目:incubator-skywalking    文件:RestRequestInterceptor.java   
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    ClientHttpRequest clientHttpRequest = (ClientHttpRequest)ret;
    if (clientHttpRequest instanceof AbstractClientHttpRequest) {
        AbstractClientHttpRequest httpRequest = (AbstractClientHttpRequest)clientHttpRequest;
        ContextCarrier contextCarrier = (ContextCarrier)objInst.getSkyWalkingDynamicField();
        CarrierItem next = contextCarrier.items();
        while (next.hasNext()) {
            next = next.next();
            httpRequest.getHeaders().set(next.getHeadKey(), next.getHeadValue());
        }
    }
    return ret;
}
项目:pinpoint    文件:RestTemplateIT.java   
@Test
public void test1() throws Exception {
    RestTemplate restTemplate = new RestTemplate();
    String forObject = restTemplate.getForObject(webServer.getCallHttpUrl(), String.class);

    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();

    verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor()));
    verifier.verifyTrace(event("REST_TEMPLATE", AbstractClientHttpRequest.class.getMethod("execute"), annotation("http.status.code", 200)));
}
项目:pinpoint    文件:RestTemplateIT.java   
@Test
public void test2() throws Exception {
    RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
    String forObject = restTemplate.getForObject(webServer.getCallHttpUrl(), String.class);

    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();

    verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor()));
    verifier.verifyTrace(event("REST_TEMPLATE", AbstractClientHttpRequest.class.getMethod("execute"), annotation("http.status.code", 200)));
}