Skip to content

Commit

Permalink
打开http链接时,以debug日志输出请求地址
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix committed Jul 21, 2015
1 parent 298fcd0 commit 70a6911
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/edu/scup/io/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public static int downloadFile(String fileUrl, File saveTo) throws IOException,
}

public static HttpURLConnection openConnection(String url) throws URISyntaxException, IOException {
if (logger.isDebugEnabled()) {
if (useProxy) {
logger.debug("open url {} with proxy {}", url, proxy);
} else {
logger.debug("open url {}", url);
}
}
URLConnection conn = useProxy ? new URI(url).toURL().openConnection(proxy) : new URI(url).toURL().openConnection();
conn.setRequestProperty("User-Agent", USER_AGENT);
conn.setReadTimeout(socketReadTimeout);
Expand Down

0 comments on commit 70a6911

Please sign in to comment.