Pourquoi ceci ne marche pas (error 405) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
		HttpClient client = new HttpClient();
        PostMethod post = new PostMethod("http://127.0.0.1:8080/interactivity/servlet/VoteResultsServlet");
        NameValuePair[] data = {
        		new NameValuePair("ID_USER","1"),
        		new NameValuePair("ID_INTERACTIVITY","1")
        };
        post.setQueryString(data);
		client.executeMethod(post);
        String response = new String(post.getResponseBodyAsString().getBytes("8859_1"));
        System.out.println(response);
        post.releaseConnection();
		}
Alors que ceci oui :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
		HttpClient client = new HttpClient();
        GetMethod post = new GetMethod("http://127.0.0.1:8080/interactivity/servlet/VoteResultsServlet");
        NameValuePair[] data = {
        		new NameValuePair("ID_USER","1"),
        		new NameValuePair("ID_INTERACTIVITY","1")
        };
        post.setQueryString(data);
		client.executeMethod(post);
        String response = new String(post.getResponseBodyAsString().getBytes("8859_1"));
        System.out.println(response);
        post.releaseConnection();
		}