okhttp3.Handshake.peerPrincipal()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(118)

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

Handshake.peerPrincipal介绍

[英]Returns the remote peer's principle, or null if that peer is anonymous.
[中]返回远程对等方的原则,如果该对等方是匿名的,则返回null。

代码示例

代码示例来源:origin: square/okhttp

@Override
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
 if (handshake == null) return null;
 return handshake.peerPrincipal();
}

代码示例来源:origin: square/okhttp

@Override public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
 Handshake handshake = handshake();
 return handshake != null ? handshake.peerPrincipal() : null;
}

代码示例来源:origin: apache/nifi

/**
 * Returns a Map of flowfile attributes from the response http headers. Multivalue headers are naively converted to comma separated strings.
 */
private Map<String, String> convertAttributesFromHeaders(URL url, Response responseHttp){
  // create a new hashmap to store the values from the connection
  Map<String, String> map = new HashMap<>();
  responseHttp.headers().names().forEach( (key) -> {
      if (key == null) {
        return;
      }
      List<String> values = responseHttp.headers().values(key);
      // we ignore any headers with no actual values (rare)
      if (values == null || values.isEmpty()) {
        return;
      }
      // create a comma separated string from the values, this is stored in the map
      String value = csv(values);
      // put the csv into the map
      map.put(key, value);
  });
  if (responseHttp.request().isHttps()) {
    Principal principal = responseHttp.handshake().peerPrincipal();
    if (principal != null) {
      map.put(REMOTE_DN, principal.getName());
    }
  }
  return map;
}

代码示例来源:origin: com.squareup.okhttp3/okhttp-android-support

@Override
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
 if (handshake == null) return null;
 return handshake.peerPrincipal();
}

代码示例来源:origin: com.squareup.okhttp3/okhttp-urlconnection

@Override public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
 Handshake handshake = handshake();
 return handshake != null ? handshake.peerPrincipal() : null;
}

代码示例来源:origin: apache/servicemix-bundles

@Override public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
 Handshake handshake = handshake();
 return handshake != null ? handshake.peerPrincipal() : null;
}

代码示例来源:origin: com.github.ljun20160606/okhttp-urlconnection

@Override public Principal getPeerPrincipal() throws SSLPeerUnverifiedException {
 Handshake handshake = handshake();
 return handshake != null ? handshake.peerPrincipal() : null;
}

代码示例来源:origin: org.apache.nifi/nifi-standard-processors

/**
 * Returns a Map of flowfile attributes from the response http headers. Multivalue headers are naively converted to comma separated strings.
 */
private Map<String, String> convertAttributesFromHeaders(URL url, Response responseHttp){
  // create a new hashmap to store the values from the connection
  Map<String, String> map = new HashMap<>();
  responseHttp.headers().names().forEach( (key) -> {
      if (key == null) {
        return;
      }
      List<String> values = responseHttp.headers().values(key);
      // we ignore any headers with no actual values (rare)
      if (values == null || values.isEmpty()) {
        return;
      }
      // create a comma separated string from the values, this is stored in the map
      String value = csv(values);
      // put the csv into the map
      map.put(key, value);
  });
  if ("HTTPS".equals(url.getProtocol().toUpperCase())) {
    map.put(REMOTE_DN, responseHttp.handshake().peerPrincipal().getName());
  }
  return map;
}

相关文章