Restful style data acquisition

Restful is a style of resource positioning and resource manipulation. Not a standard nor a protocol, just a style. Software designed based on this style can be more concise, more hierarchical, and easier to implement mechanisms such as caching.

 

Resources: Everything on the Internet can be abstracted as resources

Resource manipulation: Use POST , DELETE , PUT , GET to manipulate resources using different methods.

      Corresponding to adding, deleting, modifying and querying respectively.

 

Manipulate resources with RESTful

 

http://127.0.0.1/item/1 query , GET

 

http://127.0.0.1/item added , POST

 

http://127.0.0.1/item update , PUT

 

http://127.0.0.1/item/1 delete , DELETE

 

1  /** 
2  * Use RESTful style development interface to query items according to id
 3  * 
 4  * @param id
 5  * @return 
6   */ 
7 @RequestMapping("item/{id}" )
 8  @ResponseBody
 9  public Item queryItemById (@PathVariable() Integer id) {
 10      Item item = this .itemService.queryItemById(id);
 11      return item;
 12 }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325890277&siteId=291194637