Search in sources :

Example 36 with HttpRequest

use of com.netflix.client.http.HttpRequest in project spring-cloud-netflix by spring-cloud.

the class RibbonHttpRequest method executeInternal.

@Override
protected ClientHttpResponse executeInternal(HttpHeaders headers) throws IOException {
    try {
        addHeaders(headers);
        if (outputStream != null) {
            outputStream.close();
            builder.entity(outputStream.toByteArray());
        }
        HttpRequest request = builder.build();
        HttpResponse response = client.executeWithLoadBalancer(request, config);
        return new RibbonHttpResponse(response);
    } catch (Exception e) {
        throw new IOException(e);
    }
}
Also used : HttpRequest(com.netflix.client.http.HttpRequest) AbstractClientHttpRequest(org.springframework.http.client.AbstractClientHttpRequest) HttpResponse(com.netflix.client.http.HttpResponse) ClientHttpResponse(org.springframework.http.client.ClientHttpResponse) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

HttpRequest (com.netflix.client.http.HttpRequest)36 URI (java.net.URI)28 Test (org.junit.Test)28 HttpResponse (com.netflix.client.http.HttpResponse)21 ClientException (com.netflix.client.ClientException)9 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)5 ServerStats (com.netflix.loadbalancer.ServerStats)4 MockHttpServer (com.netflix.client.testutil.MockHttpServer)3 Server (com.netflix.loadbalancer.Server)3 RestClient (com.netflix.niws.client.http.RestClient)3 InputStream (java.io.InputStream)3 RibbonCommandContext (org.springframework.cloud.netflix.ribbon.support.RibbonCommandContext)3 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)3 IClientConfig (com.netflix.client.config.IClientConfig)2 BaseLoadBalancer (com.netflix.loadbalancer.BaseLoadBalancer)2 ZoneAwareLoadBalancer (com.netflix.loadbalancer.ZoneAwareLoadBalancer)2 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)2 MultivaluedMapImpl (com.sun.jersey.core.util.MultivaluedMapImpl)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 MockResponse (com.google.mockwebserver.MockResponse)1