zoukankan      html  css  js  c++  java
  • SpringMVC 第二节(上) 关于请求的处理

    第二节上 关于请求的处理

    2016年4月1日 星期五

    16:53

     

    A key principle of REST is the use of the Uniform Interface. This means that all resources (URLs) can be manipulated using the same four HTTP methods: GET, PUT, POST, and DELETE. For each method, the HTTP specification defines the exact semantics. For instance, a GET should always be a safe operation, meaning that is has no side effects, and a PUT or DELETE should be idempotent, meaning that you can repeat these operations over and over again, but the end result should be the same. While HTTP defines these four methods, HTML only supports two: GET and POST. Fortunately, there are two possible workarounds: you can either use JavaScript to do your PUT or DELETE, or simply do a POST with the 'real' method as an additional parameter (modeled as a hidden input field in an HTML form). This latter trick is what Spring’HiddenHttpMethodFilter does. This filter is a plain Servlet Filter and therefore it can be used in combination with any web framework (not just Spring MVC). Simply add this filter to your web.xml, and a POST with a hidden _method parameter will be converted into the corresponding HTTP method request.

     


     

     

     


     

     


     

     

     


     

     

  • 相关阅读:
    Oauth2.0认证原理
    互联网开放平台API安全设计
    API接口幂等性框架设计
    防盗链&CSRF&API接口幂等性设计
    ElasticSearch高可用集群环境搭建和分片原理
    SpringBoot2.0+ElasticSearch网盘搜索实现
    Elasticsearch6.4.3文档的映射
    中文分词器
    C# 插件
    JavaScript 网址
  • 原文地址:https://www.cnblogs.com/skycodefamily/p/5348239.html
Copyright © 2011-2022 走看看