以下代码段尝试连接到URL.该网址还会发送一个名为FileNames的参数.但是,当我运行此代码段时,总是收到不支持HTTP版本的回复.可能是什么原因呢?
try {
URL url = new URL(AddressInformation.clientAddressToSendFileNames + URLEncoder.encode(list.toString(), "UTF-8")); // STATEMENT-1
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if(connection.getResponseCode() == 200) {
// File names sent to the client that requested it
System.out.println("File names sent");
} else {
// Error : While trying to send the file names
System.out.println("Unable to send file names");
System.out.println("RESPONSE CODE ------->>>>" + connection.getResponseMessage());
}
} catch(Exception exc) {
exc.printStackTrace();
}
在STATEMENT-1中,AddressInformation.clientAddressToSendFileNames对应于
http:// localhost:8084 / D Nappster / ReceiveFileNames?FileNames =.
我正在运行Tomcat 7.