[b]HttpClientTest.java[/b]
[url=http://www.blogjava.net/Alpha/archive/2007/01/22/95216.html]HttpClient 学习整理[/url]
[url=http://simpleframework.net/blog/v/61218.html]应用HttpClient来对付各种顽固的WEB服务器[/url]
[url=http://simpleframework.net/blog/v/10903.html]HttpClient_4 用法 由HttpClient_3 升级到 HttpClient_4 必看[/url]
[url=http://wentao365.iteye.com/blog/1242768]HttpClient[/url]
public class HttpClientTest {
public static void main(String[] args) throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
try{
HttpPost post = new HttpPost("http://localhost:8080/sevletTest/page/success.jsp");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("username", "Tom"));
nvps.add(new BasicNameValuePair("password", "12345"));
HttpEntity entity = new UrlEncodedFormEntity(nvps, "UTF-8");
post.setEntity(entity);
System.out.println("Executing Request: " + post.getURI());
HttpResponse response = client.execute(post);
entity = response.getEntity();
System.out.println("Response Status: " + response.getStatusLine());
if(entity != null){
System.out.println("Response Content: " + EntityUtils.toString(entity, "UTF-8"));
}
}finally{
client.getConnectionManager().shutdown();
}
}
}
[url=http://www.blogjava.net/Alpha/archive/2007/01/22/95216.html]HttpClient 学习整理[/url]
[url=http://simpleframework.net/blog/v/61218.html]应用HttpClient来对付各种顽固的WEB服务器[/url]
[url=http://simpleframework.net/blog/v/10903.html]HttpClient_4 用法 由HttpClient_3 升级到 HttpClient_4 必看[/url]
[url=http://wentao365.iteye.com/blog/1242768]HttpClient[/url]