我有一个问题,我发射一个http请求来获取这样的头。我的目标是检查当我发起请求时,回复给我的回复。httpHead和httpClient给503
try {
HttpHead headReq = new HttpHead(imageUrl);
response = (CloseableHttpResponse) httpClient.execute(headReq);
StatusLine sl = response.getStatusLine();
if (sl.getStatusCode() == 200) {
//do something
}
} catch (Exception e) {
LOG.error(e.getMessage());
} finally {
try {
response.close();
} catch (Exception e) {
LOG.error(e.getMessage());
}
}
即使我知道URL存在,当我在浏览器中打开它时,我总是收到HTTP/1.0 503服务不可用。我在这里肯定有些事情做错了。任何人都可以帮助我看到它。
感谢
你是否拥有服务器? – sonique
这是我的公司,但我们不是业主 – Richie
也许你需要使用代理来访问它。 – SubOptimal