发表于: 2017-01-18 23:21:15

1 1940


一、今天完成的任务


1SpringMVC完成restful

Restful:的关键

RESTful的关键是定义可表示流程元素/资源的对象。在REST中,每一个对象都是通过URL来表示的,对象用户负责将状态信息打包进每一条消息内,以便对象的处理总是无状态的。

(restful风格地址)

2、创建接口

@Controller

@RequestMapping(value = "/User/*")

public class UserController {

//User "CURD"

@RequestMapping(value = "User", method = RequestMethod.POST, produces = {"application/json;charset=utf-8"})

@RequestBody

public String addUser(HttpServletRequest request){

......

}

@RequestMapping(value = "User", method = RequestMethod.PUT, produces = "application/json;charset=utf-8")

@RequestBody

public String updateUser(HttpServletRequest request) {

.......

}

@RequestMapping(value = "User" method = RequestMethod.DELETE, produces = "application/json;charset=utf-8")

@RequestBody

public String deleteUser(HttpServletRequest request) {

......

}

@RequestMapping(value = "User" method = RequestMethod.SELECT, produces = "application/json;charset = utf-8")

@RequsetBody

public String selectMapping(HttpServletRequest request) {

.......

}

}

二、明天计划的事情

什么是http协议?Get和post请求有什么区别?http请求content-Type有几种,有什么区别?http请求的三次握手具体指什么?http适合什么场景?什么是tcp/ip协议?http状态码有哪些?

三、今天的收获

插件postman测试接口


返回列表 返回列表
评论

    分享到