Comparison of several code plug-ins of Windows Live writer

Source: Internet
Author: User

1. code snippet to format:

   1: HttpPost request = new HttpPost(url);  

2: // encapsulate a JSON object first

   3: JSONObject param = new JSONObject();  

   4: param.put("name", "rarnu");  

   5: param.put("password", "123456");  

6: // bind to the request entry

   7: StringEntity se = new StringEntity(param.toString());   

   8: request.setEntity(se);  

9: // send the request

  10: HttpResponse httpResponse = new DefaultHttpClient().execute(request);  

11: // The response string, which is saved in JSON format.

  12: String retSrc = EntityUtils.toString(httpResponse.getEntity());  

13: // generate a JSON object

  14: JSONObject result = new JSONObject( retSrc);  

  15: String token = result.get("token");  

-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
2. insert Code (a few languages are supported ):
Httppost request = new httppost (URL); // encapsulate a JSON object jsonobject Param = new jsonobject (); Param. put ("name", "rarnu"); Param. put ("password", "123456"); // bind to the request entry stringentity Se = new stringentity (Param. tostring (); Request. setentity (SE); // send the request httpresponse = new defaulthttpclient(.exe cute (request); // The response string, which is also a string retsrc = entityutils stored in JSON format. tostring (httpresponse. getentity (); // generate JSON object jsonobject result = new jsonobject (retsrc); string token = result. get ("token ");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
3. Source Code Format (cannot be copied ):
HttpPost request = new HttpPost(url);  
// Encapsulate a JSON object first
JSONObject param = new JSONObject();  
param.put("name", "rarnu");  
param.put("password", "123456");  
// Bind to the request entry
StringEntity se = new StringEntity(param.toString());   
request.setEntity(se);  
// Send the request
HttpResponse httpResponse = new DefaultHttpClient().execute(request);  
// Obtain the response string, which is also the data saved in JSON format
String retSrc = EntityUtils.toString(httpResponse.getEntity());  
// Generate a JSON object
JSONObject result = new JSONObject( retSrc);  

String token = result. Get ("token ");

-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
4. Insert Source Code Plug-in:
Httppost request = new httppost (URL); // encapsulate a JSON object jsonobject Param = new jsonobject (); Param. put ("name", "rarnu"); Param. put ("password", "123456"); // bind to the request entry stringentity Se = new stringentity (Param. tostring (); Request. setentity (SE); // send the request httpresponse = new defaulthttpclient(.exe cute (request); // The response string, which is also a string retsrc = entityutils stored in JSON format. tostring (httpresponse. getentity (); // generate JSON object jsonobject result = new jsonobject (retsrc); string token = result. get ("token ");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
5. Insert a code block (Multiple blogs can be customized)
Httppost request = new httppost (URL); // encapsulate a JSON object jsonobject Param = new jsonobject (); Param. put ("name", "rarnu"); Param. put ("password", "123456"); // bind to the request entry stringentity Se = new stringentity (Param. tostring (); Request. setentity (SE); // send the request httpresponse = new defaulthttpclient(.exe cute (request); // The response string, which is also a string retsrc = entityutils stored in JSON format. tostring (httpresponse. getentity (); // generate JSON object jsonobject result = new jsonobject (retsrc); string token = result. get ("token ");
-------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Cnblog effect (advantage over csdn in 4th plug-in ):
http://www.cnblogs.com/dartagnan/archive/2011/04/02/2003895.html
51cto effect (terrible !!!)
http://dadoneo.blog.51cto.com/2908573/534096

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.