private static HttpMethod getGetMethod(String latlng) throws IOException { PostMethod post = new PostMethod("/maps/api/geocode/json"); GetMethod get = new GetMethod("/maps/api/geocode/json");
NameValuePair simcard = new NameValuePair("latlng", latlng); NameValuePair simcard1 = new NameValuePair("sensor", "false"); NameValuePair simcard2 = new NameValuePair("language", "zh-CN"); get.setQueryString(new NameValuePair[] { simcard, simcard1,simcard2});
//InputStream input = new FileInputStream(new File("/home/ubuntu/my.txt")); //"".getBytes("ISO8859-1") //InputStream input = new StringBufferInputStream("my test aaaaaaaaaa"); //post.setRequestBody(input); return get; } private static HttpMethod getPostMethod(String latlng) throws IOException { PostMethod post = new PostMethod("/maps/api/geocode/json");
//latlng=40.714224,-73.961452&sensor=false&&language=zh-TW NameValuePair simcard = new NameValuePair("latlng", latlng); NameValuePair simcard1 = new NameValuePair("sensor", "false"); NameValuePair simcard2 = new NameValuePair("language", "zh-CN");
post.setRequestBody(new NameValuePair[] { simcard, simcard1,simcard2}); //InputStream input = new FileInputStream(new File("/home/ubuntu/my.txt")); //"".getBytes("ISO8859-1") //InputStream input = new StringBufferInputStream("my test aaaaaaaaaa"); //post.setRequestBody(input); return post; }