| 
					
				 | 
			
			
				@ -8,7 +8,11 @@ import java.io.PrintWriter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.HttpURLConnection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.URL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.URLConnection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.http.NameValuePair; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.http.message.BasicNameValuePair; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.LoggerFactory; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -134,54 +138,17 @@ public class HttpUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//		param.put("type", msgType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//		param.put("title", title); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//		param.put("data", data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						PrintWriter out = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						BufferedReader in = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						HttpURLConnection conn = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String url = SystemConf.getInstance().getMsgPushServer() + "?to_uid=" + receiver + "&content=" + msg + "&type=" + msgType + "&title=" + title + "&data=" + data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							URL realUrl = new URL(url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							// 打开和URL之间的连接 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							conn = (HttpURLConnection) realUrl.openConnection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							conn.setRequestMethod("GET"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							conn.setDoOutput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							conn.setDoInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							conn.setUseCaches(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							conn.setRequestProperty("Content-Type", "application/json"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			osw.write(param.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			osw.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							// 读取返回内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							StringBuffer buffer = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String temp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							while ((temp = br.readLine()) != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								buffer.append(temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								buffer.append("\n"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							System.out.println(buffer.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							JSONObject json = new JSONObject(buffer.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if (json.getInt("errno") == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								// 成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								// 失败 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							logger.error("push message error:", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} finally { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								if (out != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
									out.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								if (in != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
									in.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} catch (IOException ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								ex.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							List<NameValuePair> params = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							params.add(new BasicNameValuePair("to", receiver)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							params.add(new BasicNameValuePair("content", msg)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							params.add(new BasicNameValuePair("contentType", msgType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							params.add(new BasicNameValuePair("title", title)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							params.add(new BasicNameValuePair("summary", data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String response = HttpClientUtil.post(SystemConf.getInstance().getMsgPushServer(), params, "UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 |