org.apache.tomcat.jni.Address.getip()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.apache.tomcat.jni.Address.getip()方法的一些代码示例,展示了Address.getip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.getip()方法的具体详情如下:
包路径:org.apache.tomcat.jni.Address
类名称:Address
方法名:getip

Address.getip介绍

[英]Return the IP address (in numeric address string format) in an APR socket address. APR will allocate storage for the IP address string from the pool of the apr_sockaddr_t.
[中]返回APR套接字地址中的IP地址(数字地址字符串格式)。APR将为APR\u sockaddr\u t池中的IP地址字符串分配存储。

代码示例

代码示例来源:origin: codefollower/Tomcat-Research

public String getRemoteAddress() throws IOException {
  if (socket != 0 && context.running) {
    try {
      long sa = Address.get(Socket.APR_REMOTE, socket);
      return Address.getip(sa);
    } catch (Exception ex) {
      throw new IOException(ex);
    }
  }
  throw new IOException("Socket closed");
}

代码示例来源:origin: codefollower/Tomcat-Research

public String getLocalAddress() throws IOException {
  if (socket != 0 && context.running) {
    try {
      long sa = Address.get(Socket.APR_LOCAL, socket);
      return Address.getip(sa);
    } catch (Exception ex) {
      throw new IOException(ex);
    }
  }
  throw new IOException("Socket closed");
}

代码示例来源:origin: codefollower/Tomcat-Research

public String getRemoteHostname() throws IOException {
  if (socket != 0 && context.running) {
    try {
      long sa = Address.get(Socket.APR_REMOTE, socket);
      String remoteHost = Address.getnameinfo(sa, 0);
      if (remoteHost == null) {
        remoteHost = Address.getip(sa);
      }
      return remoteHost;
    } catch (Exception ex) {
      throw new IOException(ex);
    }
  }
  throw new IOException("Socket closed");
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
protected void populateLocalAddr() {
  if (closed) {
    return;
  }
  try {
    long socket = getSocket().longValue();
    long sa = Address.get(Socket.APR_LOCAL, socket);
    localAddr = Address.getip(sa);
  } catch (Exception e) {
    log.warn(sm.getString("endpoint.warn.noLocalAddr"), e);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
protected void populateRemoteAddr() {
  if (closed) {
    return;
  }
  try {
    long socket = getSocket().longValue();
    long sa = Address.get(Socket.APR_REMOTE, socket);
    remoteAddr = Address.getip(sa);
  } catch (Exception e) {
    log.warn(sm.getString("endpoint.warn.noRemoteAddr", getSocket()), e);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
protected void populateRemoteHost() {
  if (closed) {
    return;
  }
  try {
    long socket = getSocket().longValue();
    long sa = Address.get(Socket.APR_REMOTE, socket);
    remoteHost = Address.getnameinfo(sa, 0);
    if (remoteAddr == null) {
      remoteAddr = Address.getip(sa);
    }
  } catch (Exception e) {
    log.warn(sm.getString("endpoint.warn.noRemoteHost", getSocket()), e);
  }
}

代码示例来源:origin: jboss.web/jbossweb

try {
  long sa = Address.get(Socket.APR_REMOTE, socket);
  remoteAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
try {
  long sa = Address.get(Socket.APR_LOCAL, socket);
  localAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

try {
  long sa = Address.get(Socket.APR_REMOTE, socketRef);
  remoteAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
  remoteHost = Address.getnameinfo(sa, 0);
  if (remoteHost == null) {
    remoteHost = Address.getip(sa);
try {
  long sa = Address.get(Socket.APR_LOCAL, socketRef);
  localAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

try {
  long sa = Address.get(Socket.APR_REMOTE, socketRef);
  remoteAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
  remoteHost = Address.getnameinfo(sa, 0);
  if (remoteHost == null) {
    remoteHost = Address.getip(sa);
try {
  long sa = Address.get(Socket.APR_LOCAL, socketRef);
  localAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

try {
  long sa = Address.get(Socket.APR_REMOTE, socketRef);
  remoteAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
  remoteHost = Address.getnameinfo(sa, 0);
  if (remoteHost == null) {
    remoteHost = Address.getip(sa);
try {
  long sa = Address.get(Socket.APR_LOCAL, socketRef);
  localAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

try {
  long sa = Address.get(Socket.APR_REMOTE, socket);
  remoteAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
  remoteHost = Address.getnameinfo(sa, 0);
  if (remoteHost == null) {
    remoteHost = Address.getip(sa);
try {
  long sa = Address.get(Socket.APR_LOCAL, socket);
  localAddr = Address.getip(sa);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);

代码示例来源:origin: org.jboss.web/jbossweb

try {
  long sa = Address.get(Socket.APR_REMOTE, socket);
  remoteAddr = Address.getip(sa);
} catch (Exception e) {
  CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
  remoteHost = Address.getnameinfo(sa, 0);
  if (remoteHost == null) {
    remoteAddr = Address.getip(sa);
    remoteHost = remoteAddr;
try {
  long sa = Address.get(Socket.APR_LOCAL, socket);
  localAddr = Address.getip(sa);
} catch (Exception e) {
  CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);

代码示例来源:origin: codefollower/Tomcat-Research

try {
  long sa = Address.get(Socket.APR_REMOTE, socketRef);
  socketWrapper.setRemoteAddr(Address.getip(sa));
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
  if (socketWrapper.getRemoteHost() == null) {
    if (socketWrapper.getRemoteAddr() == null) {
      socketWrapper.setRemoteAddr(Address.getip(sa));
try {
  long sa = Address.get(Socket.APR_LOCAL, socketRef);
  socketWrapper.setLocalAddr(Address.getip(sa));
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);

相关文章