@Nullable @Override public <A extends SocketAddress> A localAddress() { return delegate().localAddress(); }
/** * Returns the host name of the {@link Request}. * * @deprecated Do not use this method. Get the remote or local address from {@link #context()} or get * the authority from {@link #authority()}. * * @return the host name. {@code null} if the {@link Request} has failed even before a connection is * established. * @throws RequestLogAvailabilityException if this property is not available yet */ @Nullable @Deprecated default String host() { final RequestContext ctx = context(); final InetSocketAddress addr; if (ctx instanceof ClientRequestContext) { addr = ctx.remoteAddress(); } else { addr = ctx.localAddress(); } return addr != null ? addr.getHostString() : null; }
private void exportAddresses(Map<String, String> out, RequestContext ctx) { final InetSocketAddress raddr = ctx.remoteAddress(); final InetSocketAddress laddr = ctx.localAddress(); final InetAddress caddr = ctx instanceof ServiceRequestContext ? ((ServiceRequestContext) ctx).clientAddress() : null;
switch (type) { case LOCAL_IP_ADDRESS: final InetSocketAddress local = log.context().localAddress(); return local == null || local.isUnresolved() ? null : local.getAddress().getHostAddress();
span.tag("address.remote", raddr.toString()); final SocketAddress laddr = log.context().localAddress(); if (laddr != null) { span.tag("address.local", laddr.toString());
private void exportAddresses(Map<String, String> out, RequestContext ctx) { final InetSocketAddress raddr = ctx.remoteAddress(); final InetSocketAddress laddr = ctx.localAddress(); if (raddr != null) { if (builtIns.contains(REMOTE_HOST)) { out.put(REMOTE_HOST.mdcKey, raddr.getHostString()); } if (builtIns.contains(REMOTE_IP)) { out.put(REMOTE_IP.mdcKey, raddr.getAddress().getHostAddress()); } if (builtIns.contains(REMOTE_PORT)) { out.put(REMOTE_PORT.mdcKey, String.valueOf(raddr.getPort())); } } if (laddr != null) { if (builtIns.contains(LOCAL_HOST)) { out.put(LOCAL_HOST.mdcKey, laddr.getHostString()); } if (builtIns.contains(LOCAL_IP)) { out.put(LOCAL_IP.mdcKey, laddr.getAddress().getHostAddress()); } if (builtIns.contains(LOCAL_PORT)) { out.put(LOCAL_PORT.mdcKey, String.valueOf(laddr.getPort())); } } }
private void exportAddresses(Map<String, String> out, RequestContext ctx) { final InetSocketAddress raddr = ctx.remoteAddress(); final InetSocketAddress laddr = ctx.localAddress(); final InetAddress caddr = ctx instanceof ServiceRequestContext ? ((ServiceRequestContext) ctx).clientAddress() : null;