次のスニペットは、URL への接続を試みます。URL は、 という名前のパラメータも送信しますFileNames
。しかし、このスニペットを実行すると、常にHTTP Version Not Supported
返信が返ってきます。その理由は何ですか?
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を実行しています。