package com.qq;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.net.URLDecoder;
import java.io.UnsupportedEncodingException;

public class GetRequest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String httpUrl = "http://111.207.243.70:8088/IbotInfo/GetInfo";
		String sendInfo="346786495@qq.com";
		String recieveInfo="wnbupt@qq.com";
		String timeInfo="2015-12-16-10:43";
		String subjectInfo="测试demo跑起来";
		String bodyInfo="中文其实也是可以的嘛！！点赞";
		//String[] appendInfo={"D:/ibotest/test.ppt","D:/ibotest/test.doc"};
		String[] appendInfo={"null"};//没有附件的时候传入null
		String httpArg = "sender="+sendInfo+"&reciever="+recieveInfo+"&sendtime="+timeInfo+"&subject="+subjectInfo+"&body="+bodyInfo+"&attachment=";
		int i;
		for(i=0;i<appendInfo.length-1;i++)
		{
			httpArg=httpArg+appendInfo[i]+'|';
		}
		httpArg=httpArg+appendInfo[i];
		GetRequest test=new GetRequest();
		String jsonResult = test.request(httpUrl, httpArg);
		System.out.println(httpUrl+"?"+httpArg);
		System.out.println(jsonResult);
	}
	
	public static String request(String httpUrl,String httpArg) 
	{
	    BufferedReader reader = null;
	    String result = null;
	    StringBuffer sbf = new StringBuffer();	   
	    try 
	    {
	    	
	    	httpArg=URLEncoder.encode(httpArg,"utf-8");
	    	httpUrl = httpUrl + "?" + httpArg;
	        URL url = new URL(httpUrl);
	        
	        HttpURLConnection connection = (HttpURLConnection) url
	                .openConnection();
	        //connection.setRequestMethod("POST");
	        connection.connect();	      
	        java.io.InputStream is = connection.getInputStream();
	        //InputStream is = (InputStream) connection.getInputStream();
	        reader = new BufferedReader(new InputStreamReader(is,"utf-8"));
	        String strRead = null;
	        while ((strRead = reader.readLine()) != null) {
	        	//System.out.println(strRead);
	            sbf.append(strRead);
	            sbf.append("\r\n");
	        }
	        reader.close();
	        
	        result = sbf.toString();
	    } 
	    catch (Exception e) {
	        e.printStackTrace();
	    }
	    return result;
	}
	
}

@@ -569,11 +569,8 @@
 demo
-%E8%B7%91%E8%B5%B7%E6%9D%A5
 %22;%0D%0A
@@ -592,22 +592,18 @@
 fo=%22
-%E4%B8%AD%E6%96%87%E5%85%B6%E5%AE%9E%E4%B9%9F%E6%98%AF%E5%8F%AF%E4%BB%A5%E7%9A%84%E5%98%9B%EF%BC%81%EF%BC%81%E7%82%B9%E8%B5%9E
+%E5%BF%AB%E5%A1%9E%E7%BB%99%E6%88%91%E4%B8%80%E5%B0%81%E9%82%AE%E4%BB%B6%E5%90%A7%EF%BC%81
 %22;%0D%0A

make the same