1. Code Snippet to Format:
1: HttpPost request = new HttpPost(url);
2: // 先封裝一個 JSON 對象
3: JSONObject param = new JSONObject();
4: param.put("name", "rarnu");
5: param.put("password", "123456");
6: // 綁定到請求 Entry
7: StringEntity se = new StringEntity(param.toString());
8: request.setEntity(se);
9: // 發送請求
10: HttpResponse httpResponse = new DefaultHttpClient().execute(request);
11: // 得到應答的字串,這也是一個 JSON 格式儲存的資料
12: String retSrc = EntityUtils.toString(httpResponse.getEntity());
13: // 產生 JSON 對象
14: JSONObject result = new JSONObject( retSrc);
15: String token = result.get("token");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
2. Insert Code(支援少量語言):
HttpPost request = new HttpPost(url); // 先封裝一個 JSON 對象 JSONObject param = new JSONObject(); param.put("name", "rarnu"); param.put("password", "123456"); // 綁定到請求 Entry StringEntity se = new StringEntity(param.toString()); request.setEntity(se); // 發送請求 HttpResponse httpResponse = new DefaultHttpClient().execute(request); // 得到應答的字串,這也是一個 JSON 格式儲存的資料 String retSrc = EntityUtils.toString(httpResponse.getEntity()); // 產生 JSON 對象 JSONObject result = new JSONObject( retSrc); String token = result.get("token");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
3. Source Code Format(不能複製):
HttpPost request = new HttpPost(url);
// 先封裝一個 JSON 對象
JSONObject param = new JSONObject();
param.put("name", "rarnu");
param.put("password", "123456");
// 綁定到請求 Entry
StringEntity se = new StringEntity(param.toString());
request.setEntity(se);
// 發送請求
HttpResponse httpResponse = new DefaultHttpClient().execute(request);
// 得到應答的字串,這也是一個 JSON 格式儲存的資料
String retSrc = EntityUtils.toString(httpResponse.getEntity());
// 產生 JSON 對象
JSONObject result = new JSONObject( retSrc);
String token = result.get("token");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
4. Insert Source Code Plug-in:
HttpPost request = new HttpPost(url); // 先封裝一個 JSON 對象 JSONObject param = new JSONObject(); param.put("name", "rarnu"); param.put("password", "123456"); // 綁定到請求 Entry StringEntity se = new StringEntity(param.toString()); request.setEntity(se); // 發送請求 HttpResponse httpResponse = new DefaultHttpClient().execute(request); // 得到應答的字串,這也是一個 JSON 格式儲存的資料 String retSrc = EntityUtils.toString(httpResponse.getEntity()); // 產生 JSON 對象 JSONObject result = new JSONObject( retSrc); String token = result.get("token");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
5. 插入代碼塊(可以定製多個BLOG)
HttpPost request = new HttpPost(url); // 先封裝一個 JSON 對象 JSONObject param = new JSONObject(); param.put("name", "rarnu"); param.put("password", "123456"); // 綁定到請求 Entry StringEntity se = new StringEntity(param.toString()); request.setEntity(se); // 發送請求 HttpResponse httpResponse = new DefaultHttpClient().execute(request); // 得到應答的字串,這也是一個 JSON 格式儲存的資料 String retSrc = EntityUtils.toString(httpResponse.getEntity()); // 產生 JSON 對象 JSONObject result = new JSONObject( retSrc); String token = result.get("token");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
cnblog效果(較CSDN在第4外掛程式上有優勢):
http://www.cnblogs.com/dartagnan/archive/2011/04/02/2003895.html
51CTO效果(慘不忍睹!!!)
http://dadoneo.blog.51cto.com/2908573/534096