当前位置: 首页>>代码示例>>Java>>正文


Java SocketAddress.host方法代码示例

本文整理汇总了Java中io.vertx.core.net.SocketAddress.host方法的典型用法代码示例。如果您正苦于以下问题:Java SocketAddress.host方法的具体用法?Java SocketAddress.host怎么用?Java SocketAddress.host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.core.net.SocketAddress的用法示例。


在下文中一共展示了SocketAddress.host方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFormattedElement

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
  HttpServerRequest request = accessLogParam.getRoutingContext().request();
  if (null == request) {
    return EMPTY_RESULT;
  }

  SocketAddress remoteAddress = request.remoteAddress();
  if (null == remoteAddress) {
    return EMPTY_RESULT;
  }

  String remoteHost = remoteAddress.host();
  if (StringUtils.isEmpty(remoteHost)) {
    return EMPTY_RESULT;
  }
  return remoteHost;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:RemoteHostElement.java

示例2: getFormattedElement

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Override
public String getFormattedElement(AccessLogParam accessLogParam) {
  HttpServerRequest request = accessLogParam.getRoutingContext().request();
  if (null == request) {
    return EMPTY_RESULT;
  }

  SocketAddress localAddress = request.localAddress();
  if (null == localAddress) {
    return EMPTY_RESULT;
  }

  String localHost = localAddress.host();
  if (StringUtils.isEmpty(localHost)) {
    return EMPTY_RESULT;
  }
  return localHost;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:19,代码来源:LocalHostElement.java

示例3: testGetRemoteAddr

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Test
public void testGetRemoteAddr(@Mocked SocketAddress sa) {
  new Expectations() {
    {
      sa.host();
      result = "host";
      vertxRequest.remoteAddress();
      result = sa;
    }
  };

  Assert.assertEquals("host", request.getRemoteAddr());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxServerRequestToHttpServletRequest.java

示例4: testGetRemoteHost

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Test
public void testGetRemoteHost(@Mocked SocketAddress sa) {
  new Expectations() {
    {
      sa.host();
      result = "host";
      vertxRequest.remoteAddress();
      result = sa;
    }
  };

  Assert.assertEquals("host", request.getRemoteHost());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxServerRequestToHttpServletRequest.java

示例5: testGetgetLocalAddr

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Test
public void testGetgetLocalAddr(@Mocked SocketAddress sa) {
  new Expectations() {
    {
      sa.host();
      result = "host";
      vertxRequest.localAddress();
      result = sa;
    }
  };

  Assert.assertEquals("host", request.getLocalAddr());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:14,代码来源:TestVertxServerRequestToHttpServletRequest.java

示例6: getClientAddress

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
private String getClientAddress(HttpServerRequest request) {
    SocketAddress address = request.remoteAddress();
    if (address == null) return null;
    return address.host();
}
 
开发者ID:mpusher,项目名称:mpns,代码行数:6,代码来源:AccessLogHandler.java

示例7: remoteAddress

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Override
public String remoteAddress() {
    SocketAddress address = httpServerRequest.remoteAddress();
    return (address != null) ? address.host() : null;
}
 
开发者ID:gravitee-io,项目名称:gravitee-gateway,代码行数:6,代码来源:VertxHttpServerRequest.java

示例8: localAddress

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Override
public String localAddress() {
    SocketAddress address = httpServerRequest.localAddress();
    return (address != null) ? address.host() : null;
}
 
开发者ID:gravitee-io,项目名称:gravitee-gateway,代码行数:6,代码来源:VertxHttpServerRequest.java

示例9: addressName

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
static String addressName(SocketAddress address) {
  if (address == null) return null;

  return address.host() + ":" + address.port();
}
 
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:6,代码来源:TCPMetricsImpl.java

示例10: getClientAddress

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
private String getClientAddress(SocketAddress inetSocketAddress) {
  if (inetSocketAddress == null) {
    return null;
  }
  return inetSocketAddress.host();
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:7,代码来源:LoggerHandlerImpl.java

示例11: setRemoteAddress

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
public void setRemoteAddress(SocketAddress socketAddress) {
    remoteHost = socketAddress.host();
    remotePort = socketAddress.port();
}
 
开发者ID:wired-mind,项目名称:usher,代码行数:5,代码来源:Message.java

示例12: setLocalAddress

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
public void setLocalAddress(SocketAddress socketAddress) {
    localHost = socketAddress.host();
    localPort = socketAddress.port();
}
 
开发者ID:wired-mind,项目名称:usher,代码行数:5,代码来源:Message.java

示例13: host

import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
/**
 * The request host.
 */
@Override
public String host() {
    SocketAddress remote = request.remoteAddress();
    return remote.host();
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:9,代码来源:RequestFromVertx.java


注:本文中的io.vertx.core.net.SocketAddress.host方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。