本文整理了Java中com.github.kevinsawicki.http.HttpRequest.trustAllCerts()
方法的一些代码示例,展示了HttpRequest.trustAllCerts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpRequest.trustAllCerts()
方法的具体详情如下:
包路径:com.github.kevinsawicki.http.HttpRequest
类名称:HttpRequest
方法名:trustAllCerts
[英]Configure HTTPS connection to trust all certificates
This method does nothing if the current request is not a HTTPS request
[中]配置HTTPS连接以信任所有证书
如果当前请求不是HTTPS请求,则此方法不执行任何操作
代码示例来源:origin: ihaolin/antares
private void trustHttps(HttpRequest request) {
request.trustAllCerts().trustAllHosts();
}
代码示例来源:origin: me.hao0/common
private void trustHttps(HttpRequest request) {
request.trustAllCerts().trustAllHosts();
}
代码示例来源:origin: ihaolin/common
private void trustHttps(HttpRequest request) {
request.trustAllCerts().trustAllHosts();
}
代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse
private void addHeaders( HttpRequest request ) {
Set<String> keySet = headers.keySet();
for( String key : keySet ) {
List<String> values = headers.get( key );
StringBuilder builder = new StringBuilder();
for( String value : values ) {
builder.append( value + "," );
}
request.header( key, builder.substring( 0, builder.length() - 1 ) );
}
request.trustAllCerts();
request.trustAllHosts();
}
代码示例来源:origin: no.cantara.base/Hystrix-BaseCommands
private HttpRequest initializeRequest() throws MalformedURLException {
HttpRequest request = getRequest();
if (request != null) {
request.trustAllCerts();
request.trustAllHosts();
}
return request;
}
代码示例来源:origin: stackoverflow.com
HttpRequest req = HttpRequest.get("https://google.com");
req.trustAllCerts();
req.trustAllHosts(); //If you are having certificate problems
int code = req.code();
String body = req.body();
Log.d("CODE:", String.valueOf(code));
Log.d("BODY:", body);
代码示例来源:origin: org.codehaus.sonar/sonar-batch
@VisibleForTesting
void uploadMultiPartReport(File report) {
LOG.debug("Publish results");
long startTime = System.currentTimeMillis();
URL url;
try {
url = new URL(serverClient.getURL() + "/api/computation/submit_report?projectKey=" + project.getEffectiveKey());
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid URL", e);
}
HttpRequest request = HttpRequest.post(url);
request.trustAllCerts();
request.trustAllHosts();
request.header("User-Agent", String.format("SonarQube %s", server.getVersion()));
request.basic(serverClient.getLogin(), serverClient.getPassword());
request.part("report", null, "application/octet-stream", report);
if (!request.ok()) {
int responseCode = request.code();
if (responseCode == 401) {
throw new IllegalStateException(String.format(serverClient.getMessageWhenNotAuthorized(), CoreProperties.LOGIN, CoreProperties.PASSWORD));
}
if (responseCode == 403) {
// SONAR-4397 Details are in response content
throw new IllegalStateException(request.body());
}
throw new IllegalStateException(String.format("Fail to execute request [code=%s, url=%s]: %s", responseCode, url, request.body()));
}
long stopTime = System.currentTimeMillis();
LOG.info("Analysis reports sent to server in " + (stopTime - startTime) + "ms");
}
代码示例来源:origin: BoD/jraf-android-util
public static void setDefaultOptions(HttpRequest req) throws IOException {
req.userAgent(HTTP_USER_AGENT);
req.connectTimeout(CONNECT_TIMEOUT);
req.readTimeout(READ_TIMEOUT);
req.acceptGzipEncoding();
req.uncompress(true);
req.trustAllCerts();
req.trustAllHosts();
}
代码示例来源:origin: no.cantara.base/Hystrix-BaseCommands
request = HttpRequest.post(uriString);
request.trustAllCerts();
request.trustAllHosts();
代码示例来源:origin: no.cantara.base/Hystrix-BaseCommands
request = HttpRequest.delete(uriString);
request.trustAllCerts();
request.trustAllHosts();
代码示例来源:origin: no.cantara.base/Hystrix-BaseCommands
request = HttpRequest.put(uriString);
request.trustAllCerts();
request.trustAllHosts();
内容来源于网络,如有侵权,请联系作者删除!