Tuesday, November 2, 2010

Defualt http client

can any body tell how this code works
DefaultHttpClient hc=new DefaultHttpClient(); 
                    ResponseHandler <String> res=new BasicResponseHandler(); 
                    HttpPost postMethod=new HttpPost("url"); 
                    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(12);
                    nameValuePairs.add(new BasicNameValuePair("user1", "masood@gmail.com"));
                    nameValuePairs.add(new BasicNameValuePair("pass", "Tritone"));
                    nameValuePairs.add(new BasicNameValuePair("name", "samyuctha"));
                    nameValuePairs.add(new BasicNameValuePair("message",msg));
                    postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));   
                    String response=hc.execute(postMethod,res);