本文整理汇总了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;
}
示例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;
}
示例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();
}
示例7: remoteAddress
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Override
public String remoteAddress() {
SocketAddress address = httpServerRequest.remoteAddress();
return (address != null) ? address.host() : null;
}
示例8: localAddress
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
@Override
public String localAddress() {
SocketAddress address = httpServerRequest.localAddress();
return (address != null) ? address.host() : null;
}
示例9: addressName
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
static String addressName(SocketAddress address) {
if (address == null) return null;
return address.host() + ":" + address.port();
}
示例10: getClientAddress
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
private String getClientAddress(SocketAddress inetSocketAddress) {
if (inetSocketAddress == null) {
return null;
}
return inetSocketAddress.host();
}
示例11: setRemoteAddress
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
public void setRemoteAddress(SocketAddress socketAddress) {
remoteHost = socketAddress.host();
remotePort = socketAddress.port();
}
示例12: setLocalAddress
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
public void setLocalAddress(SocketAddress socketAddress) {
localHost = socketAddress.host();
localPort = socketAddress.port();
}
示例13: host
import io.vertx.core.net.SocketAddress; //导入方法依赖的package包/类
/**
* The request host.
*/
@Override
public String host() {
SocketAddress remote = request.remoteAddress();
return remote.host();
}