对于特定的HTTPS URL,以下Java代码无法正确检索Content-Type:
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
String mimeType = connection.getContentType();
if (mimeType == null) throw new Exception("Could not detemine mimetype for remote URL.");
但是,如果我使用-I卷曲URL,我会得到以下内容:
HTTP/1.1 200 OK
Date: Wed, 23 Jul 2014 00:50:01 GMT
Server: Apache/2.4.7 (Ubuntu)
Cache-Control: max-age=0, no-cache
Connection: close
Content-Type: text/html
此外,如果我在没有URL为HTTPS的情况下运行Java代码,则getContentType会成功检索mime类型。最后,Java代码适用于使用HTTPS连接的其他服务器。
答案 0 :(得分:0)
网址使用的是AES-256 SSL,我遇到了这样的问题:Java SSL DH Keypair Generation - Prime Size Error
我要么必须更新我的java或使用充气城堡。