Example usage for io.vertx.core.http HttpServerRequest host

List of usage examples for io.vertx.core.http HttpServerRequest host

Introduction

In this page you can find the example usage for io.vertx.core.http HttpServerRequest host.

Prototype

@Nullable
String host();

Source Link

Usage

From source file:com.navercorp.pinpoint.plugin.vertx.interceptor.HttpServerRequestAdaptor.java

License:Apache License

@Override
public String getEndPoint(HttpServerRequest request) {
    if (request.localAddress() != null) {
        final int port = request.localAddress().port();
        if (port <= 0) {
            return request.host();
        } else {//from ww w .  java  2  s  .c  om
            return request.host() + ":" + port;
        }
    }
    return null;
}

From source file:com.navercorp.pinpoint.plugin.vertx.interceptor.ServerConnectionHandleRequestInterceptor.java

License:Apache License

private void recordRootSpan(final SpanRecorder recorder, final HttpServerRequest request) {
    // root//w ww  . j a  va 2  s .  co m
    recorder.recordServiceType(VertxConstants.VERTX_HTTP_SERVER);
    final String requestURL = request.path();
    if (requestURL != null) {
        recorder.recordRpcName(requestURL);
    }

    if (request.localAddress() != null) {
        final int port = request.localAddress().port();
        if (port <= 0) {
            recorder.recordEndPoint(request.host());
        } else {
            recorder.recordEndPoint(request.host() + ":" + port);
        }
    }

    final String remoteAddr = remoteAddressResolver.resolve(request);
    recorder.recordRemoteAddress(remoteAddr);

    if (!recorder.isRoot()) {
        recordParentInfo(recorder, request);
    }
    recorder.recordApi(VERTX_HTTP_SERVER_METHOD_DESCRIPTOR);

    // record proxy HTTP header.
    this.proxyHttpHeaderRecorder.record(recorder, new ProxyHttpHeaderHandler() {
        @Override
        public String read(String name) {
            return request.getHeader(name);
        }
    });
}