我知道HTTP PUT是一个幂等请求,根据定义(引自 rfc )
I know HTTP PUT is an idempotent request that store something at a specific URI, according to the definition (quoted from the rfc)
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.但是'封闭实体'的定义是什么?我似乎无法发送表单数据(如HTTP POST请求)。如何通过JSON / XML或其他序列化格式发送实体的表示?
But what is the definition of 'enclosed entity'? It doesn't seem possible for me to send form data (like for HTTP POST request) over. What about sending representation of the entity via JSON/XML or in other serialization formats?
简而言之,如何将HTTP PUT请求发送到存储/更新信息然后是一个特定的URI?
In short, how does one send a HTTP PUT request over to store/update info at a specific URI then?
推荐答案包含的实体是HTTP消息体中包含的有效负载数据(在任何传输编码之后)如果您在发送邮件正文时遇到问题,那么您可能忘记包含Content-Length标头 - 这是表明HTTP邮件有正文的两种方法之一。
The enclosed entity is the payload data contained in the HTTP message body (after any transfer encodings have been removed.) If you're having trouble sending the message body then it could be that you've forgotten to include a Content-Length header - that's one of two ways to indicate that the HTTP message has a body.
除了这种语义差异外,PUT与POST相同:使用POST,URI标识将处理实体的资源,例如servlet。使用PUT,URI标识实体本身,例如将使用实体主体的内容创建/替换的文件。
PUT is the same as POST except for this semantic difference: With POST the URI identifies a resource that will handle the entity, such as a servlet. With PUT the URI identifies the entity itself, for example a file that will be created/replaced with the contents of the entity body.
更多推荐
如何发出HTTP PUT请求?
发布评论