Example usage for io.vertx.core.http RequestOptions setHost

List of usage examples for io.vertx.core.http RequestOptions setHost

Introduction

In this page you can find the example usage for io.vertx.core.http RequestOptions setHost.

Prototype

public RequestOptions setHost(String host) 

Source Link

Document

Set the host name to be used by the client request.

Usage

From source file:org.apache.servicecomb.transport.rest.client.http.RestClientInvocation.java

License:Apache License

void createRequest(IpPort ipPort, String path) {
    URIEndpointObject endpoint = (URIEndpointObject) invocation.getEndpoint().getAddress();
    RequestOptions requestOptions = new RequestOptions();
    requestOptions.setHost(ipPort.getHostOrIp()).setPort(ipPort.getPort()).setSsl(endpoint.isSslEnabled())
            .setURI(path);//ww  w .  j  a va  2  s.c  o  m

    HttpMethod method = getMethod();
    LOGGER.debug("Sending request by rest, method={}, qualifiedName={}, path={}, endpoint={}.", method,
            invocation.getMicroserviceQualifiedName(), path, invocation.getEndpoint().getEndpoint());
    clientRequest = httpClientWithContext.getHttpClient().request(method, requestOptions, this::handleResponse);
}