本文整理了Java中org.glassfish.grizzly.Connection.getLocalAddress()
方法的一些代码示例,展示了Connection.getLocalAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getLocalAddress()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:getLocalAddress
[英]Get the connection local address
[中]获取连接本地地址
代码示例来源:origin: apache/incubator-dubbo
@Override
public InetSocketAddress getLocalAddress() {
return (InetSocketAddress) connection.getLocalAddress();
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public InetSocketAddress getLocalAddress() {
return (InetSocketAddress) connection.getLocalAddress();
}
代码示例来源:origin: javaee/grizzly
/**
* @return the Internet Protocol (IP) port number of the interface on which
* the request was received.
*/
public int getLocalPort() {
if (localPort == -1) {
localPort = ((InetSocketAddress) connection.getLocalAddress()).getPort();
}
return localPort;
}
代码示例来源:origin: javaee/grizzly
/**
* @return the Internet Protocol (IP) port number of the interface on which
* the request was received.
*/
public int getLocalPort() {
if (localPort == -1) {
localPort = ((InetSocketAddress) connection.getLocalAddress()).getPort();
}
return localPort;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
/**
* @return the Internet Protocol (IP) port number of the interface on which
* the request was received.
*/
public int getLocalPort() {
if (localPort == -1) {
localPort = ((InetSocketAddress) connection.getLocalAddress()).getPort();
}
return localPort;
}
代码示例来源:origin: javaee/grizzly
/**
* @return the Internet Protocol (IP) port number of the interface on which
* the request was received.
*/
public int getLocalPort() {
if (localPort == -1) {
localPort = ((InetSocketAddress) connection.getLocalAddress()).getPort();
}
return localPort;
}
代码示例来源:origin: javaee/grizzly
@Override
public void onBindEvent(Connection connection) {
final String bindAddress = connection.getLocalAddress().toString();
if (boundConnections.putIfAbsent(connection, bindAddress) == null) {
boundAddresses.add(bindAddress);
}
}
代码示例来源:origin: org.mule.services/mule-service-http
@Override
public Executor getThreadPoolFor(Connection connection, IOEvent ioEvent) {
if (WORKER_THREAD_EVENT_SET.contains(ioEvent)) {
final String ip = ((InetSocketAddress) connection.getLocalAddress()).getAddress().getHostAddress();
final int port = ((InetSocketAddress) connection.getLocalAddress()).getPort();
return executorProvider.getExecutor(new DefaultServerAddress(ip, port));
} else {
// Run other types of IOEvent in selector thread.
return null;
}
}
代码示例来源:origin: org.mule.modules/mule-module-http
private F retrieveFilter(Connection connection)
{
final InetSocketAddress inetAddress = (InetSocketAddress) connection.getLocalAddress();
final int port = inetAddress.getPort();
final String ip = inetAddress.getAddress().getHostAddress();
return filters.get(new ServerAddress(ip, port));
}
代码示例来源:origin: org.mule.services/mule-service-http
private F retrieveFilter(Connection connection) {
final InetSocketAddress inetAddress = (InetSocketAddress) connection.getLocalAddress();
final int port = inetAddress.getPort();
final String ip = inetAddress.getAddress().getHostAddress();
return filters.get(new DefaultServerAddress(ip, port));
}
代码示例来源:origin: javaee/grizzly
/**
* @return a {@link DataChunk} representing the host name of the
* Internet Protocol (IP) interface on which the request was received.
*/
public DataChunk localName() {
if (localNameC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localNameC.setString(inetAddr.getHostName());
}
return localNameC;
}
代码示例来源:origin: javaee/grizzly
/**
* @return a {@link DataChunk} representing the Internet Protocol (IP)
* address of the interface on which the request was received.
*/
public DataChunk localAddr() {
if (localAddressC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localAddressC.setString(inetAddr.getHostAddress());
}
return localAddressC;
}
代码示例来源:origin: javaee/grizzly
/**
* @return a {@link DataChunk} representing the host name of the
* Internet Protocol (IP) interface on which the request was received.
*/
public DataChunk localName() {
if (localNameC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localNameC.setString(inetAddr.getHostName());
}
return localNameC;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http
/**
* @return a {@link DataChunk} representing the Internet Protocol (IP)
* address of the interface on which the request was received.
*/
public DataChunk localAddr() {
if (localAddressC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localAddressC.setString(inetAddr.getHostAddress());
}
return localAddressC;
}
代码示例来源:origin: javaee/grizzly
/**
* @return a {@link DataChunk} representing the Internet Protocol (IP)
* address of the interface on which the request was received.
*/
public DataChunk localAddr() {
if (localAddressC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localAddressC.setString(inetAddr.getHostAddress());
}
return localAddressC;
}
代码示例来源:origin: javaee/grizzly
/**
* @return a {@link DataChunk} representing the host name of the
* Internet Protocol (IP) interface on which the request was received.
*/
public DataChunk localName() {
if (localNameC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localNameC.setString(inetAddr.getHostName());
}
return localNameC;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* @return a {@link DataChunk} representing the Internet Protocol (IP)
* address of the interface on which the request was received.
*/
public DataChunk localAddr() {
if (localAddressC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localAddressC.setString(inetAddr.getHostAddress());
}
return localAddressC;
}
代码示例来源:origin: javaee/grizzly
/**
* @return a {@link DataChunk} representing the Internet Protocol (IP)
* address of the interface on which the request was received.
*/
public DataChunk localAddr() {
if (localAddressC.isNull()) {
InetAddress inetAddr = ((InetSocketAddress) connection
.getLocalAddress()).getAddress();
localAddressC.setString(inetAddr.getHostAddress());
}
return localAddressC;
}
代码示例来源:origin: org.mule.services/mule-service-http
@Before
public void before() throws UnknownHostException {
ioStrategy = new ExecutorPerServerAddressIOStrategy(executorProvider);
when(connection.getLocalAddress()).thenReturn(new InetSocketAddress(InetAddress.getLocalHost(), 80));
when(executorProvider.getExecutor(any(ServerAddress.class))).thenReturn(executor);
}
代码示例来源:origin: org.mule.services/mule-service-http
private DefaultHttpRequestContext createRequestContext(FilterChainContext ctx, String scheme,
GrizzlyHttpRequestAdapter httpRequest) {
DefaultClientConnection clientConnection;
SSLSession sslSession = (SSLSession) ctx.getAttributes().getAttribute(SSL_SESSION_ATTRIBUTE_KEY);
if (sslSession != null) {
clientConnection = new DefaultClientConnection(sslSession, (InetSocketAddress) ctx.getConnection().getPeerAddress());
} else {
clientConnection = new DefaultClientConnection((InetSocketAddress) ctx.getConnection().getPeerAddress());
}
ServerConnection serverConnection = new DefaultServerConnection((InetSocketAddress) ctx.getConnection().getLocalAddress());
return new DefaultHttpRequestContext(scheme, httpRequest, clientConnection, serverConnection);
}
内容来源于网络,如有侵权,请联系作者删除!