本文整理了Java中javax.net.ssl.HttpsURLConnection.getURL()
方法的一些代码示例,展示了HttpsURLConnection.getURL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpsURLConnection.getURL()
方法的具体详情如下:
包路径:javax.net.ssl.HttpsURLConnection
类名称:HttpsURLConnection
方法名:getURL
暂无
代码示例来源:origin: org.shipkit/shipkit
private String call(String method, HttpsURLConnection conn) throws IOException {
LOG.info(" Calling {} {}. Turn on debug logging to see response headers.", method, conn.getURL());
if (conn.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
return IOUtil.readFully(conn.getInputStream());
} else {
String errorMessage =
String.format("%s %s failed, response code = %s, response body:\n%s",
method, conn.getURL(), conn.getResponseCode(), IOUtil.readFully(conn.getErrorStream()));
throw new IOException(errorMessage);
}
}
}
代码示例来源:origin: mockito/shipkit
private String call(String method, HttpsURLConnection conn) throws IOException {
LOG.info(" Calling {} {}. Turn on debug logging to see response headers.", method, conn.getURL());
if (conn.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
return IOUtil.readFully(conn.getInputStream());
} else {
String errorMessage =
String.format("%s %s failed, response code = %s, response body:\n%s",
method, conn.getURL(), conn.getResponseCode(), IOUtil.readFully(conn.getErrorStream()));
throw new IOException(errorMessage);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-glassfish-tooling
LOGGER.log(Level.INFO, METHOD, "issue", conn.getURL());
LOGGER.log(Level.INFO, METHOD, "exception", ex);
代码示例来源:origin: AzureAD/azure-activedirectory-library-for-java
static String readResponseFromConnection(final HttpsURLConnection conn)
throws AuthenticationException, IOException {
InputStream is = null;
try {
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
String msg = "Server returned HTTP response code: " + conn.getResponseCode() + " for URL : " +
conn.getURL();
is = conn.getErrorStream();
if (is != null) {
msg = msg + ", Error details : " + inputStreamToString(is);
}
throw new AuthenticationException(msg);
}
is = conn.getInputStream();
return inputStreamToString(is);
}
finally {
if(is != null){
is.close();
}
}
}
代码示例来源:origin: com.microsoft.azure/adal4j
static String readResponseFromConnection(final HttpsURLConnection conn)
throws AuthenticationException, IOException {
InputStream is = null;
try {
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
String msg = "Server returned HTTP response code: " + conn.getResponseCode() + " for URL : " +
conn.getURL();
is = conn.getErrorStream();
if (is != null) {
msg = msg + ", Error details : " + inputStreamToString(is);
}
throw new AuthenticationException(msg);
}
is = conn.getInputStream();
return inputStreamToString(is);
}
finally {
if(is != null){
is.close();
}
}
}
代码示例来源:origin: org.beigesoft/beigesoft-replicator
HttpsURLConnection urlConnection = (HttpsURLConnection) url
.openConnection();
if (!url.getHost().equals(urlConnection.getURL().getHost())) {
throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
"You should sign-in in browser first!");
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai
String errMsg = "Cannot connect to : " + conn.getURL().getHost() + ", caused by " + e.getMessage();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
代码示例来源:origin: google/sagetv
SDSession.writeDebugLine(connection.getURL() + " (received): ");
代码示例来源:origin: org.beigesoft/beigesoft-replicator
if (!pUrl.getHost().equals(urlConnection.getURL().getHost())) {
throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
"You should sign-in in browser first!");
内容来源于网络,如有侵权,请联系作者删除!