【JavaWeb】Restful实操入门

一、为什么要使用Restful设计风格

https://www.cnblogs.com/llsg/p/11358562.html

 

二、为什么要使用RestController

https://blog.csdn.net/qq_20597727/article/details/82347014

“对不需要返回页面的Controller都采用RestController进行注解”

https://blog.csdn.net/u010412719/article/details/69710480?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

"@Controller 用来响应页面,@Controller必须配合模版来使用"

 

老师:

”用restful方式每次浏览器与服务器之间交换的数据只有json字符串,而以往的方式传输的是整个页面,相差非常大;另外客户端不只是有浏览器,手机、桌面程序都可以访问restful api。 实际部署的时候,html与js可以部署在static当中,也可以单独部署在其他的服务器上。“

”其实如果只是考虑功能性需求开发都够用,但是如果把性能、伸缩性等非功能性因素考虑进去,restful可能会容易做到。
实际部署时,直接把VScode的代码考Spring boot的工程文件里就可以,当然也可以增加其它的服务器“

三、如何设计RestController的内容

https://blog.csdn.net/u010924834/article/details/50964662?utm_source=blogkpcl0 

https://www.cnblogs.com/chinajava/p/5871310.html 

   1. 三要素

      Request:

      Request body:

      Response body:

    1.1  Request:

    1.2  Request body:

    1.3  Response body:

posted @ 2020-03-30 16:26  SeasonBubble  阅读(235)  评论(0)    收藏  举报