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

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

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

Address.getnameinfo介绍

[英]Look up the host name from an apr_sockaddr_t.
[中]从apr\u sockaddr\t中查找主机名。

代码示例

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

public String getLocalHostname() throws IOException {
  if (socket != 0 && context.running) {
    try {
      long sa = Address.get(Socket.APR_LOCAL, socket);
      return Address.getnameinfo(sa, 0);
    } 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 populateLocalName() {
  if (closed) {
    return;
  }
  try {
    long socket = getSocket().longValue();
    long sa = Address.get(Socket.APR_LOCAL, socket);
    localName =Address.getnameinfo(sa, 0);
  } catch (Exception e) {
    log.warn(sm.getString("endpoint.warn.noLocalName"), 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_LOCAL, socket);
  localName = Address.getnameinfo(sa, 0);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
try {
  long sa = Address.get(Socket.APR_REMOTE, socket);
  remoteHost = Address.getnameinfo(sa, 0);
} 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_LOCAL, socketRef);
  localName = Address.getnameinfo(sa, 0);
} catch (Exception e) {
  log.warn(sm.getString("http11processor.socket.info"), e);
try {
  long sa = Address.get(Socket.APR_REMOTE, socketRef);
  remoteHost = Address.getnameinfo(sa, 0);
  if (remoteHost == null) {
    remoteHost = Address.getip(sa);

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

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

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

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

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

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

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

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

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

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

相关文章