开发者

Are there any performance benefits to PUT and DELETE HTTP methods?

Most of the Web servers and frameworks support by default GET and POST HTTP methods and do not promote or even disallow usage of PUT and DELETE methods. I know using the latter is conceptually more appropriate and e.g. minimizes the URL scheme of the site, but are there actually any performance benefits involved (like less 开发者_StackOverflow社区requests, less processing)? If yes, then brief explanation with an example would be perfect for me.


There really are no performance benefits of using PUT and DELETE over POST. Also, it is not essential to use PUT and DELETE to be RESTful. It is recommended but not required. See this.


It is important to distinguish between what the framework is and what a REST system is. That is, using a framework for web not necessarily will make the system a RESTful one.

That said, It is not about what you use, but how you use it. So, PUT and DELETE are not needed to be RESTFul, but they do represent a interesting decision.

See, when a client performs a DELETE, it must know what resource is deleting. And it is deleting the full resource. If you have for instance a Bill (header plus detail lines), and you want to represent the full Bill as one big resource, DELETE will not work. You can actually modify the Bill with POST. If you already have a resource called detail line, and you want to eliminate it, using POST when there is a DELETE command for resource may violate the constrains of protocol.

If you wont delete anything, ever, because the client has no control of creation and deletion of resource for instance, not using DELETE becomes natural.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜