http-method

Are REST API's really RESTful?

左心房为你撑大大i 提交于 2019-12-21 20:54:35
问题 I'm new to this game so I might be misunderstanding things. Actually, if someone tells me that I'm misunderstanding things, it will be a favor. Maybe this person will be considerate enough to show me the right path. But... One of the " guidelines " or " best practices " of REST as it applies to Web Services (http://en.wikipedia.org/wiki/Representational_state_transfer#Applied_to_web_services) is that you should use the proper HTTP methods when making calls (did I misunderstand it?) to REST

Overwrite HTTP method with JAX-RS

拜拜、爱过 提交于 2019-12-20 03:50:41
问题 Today's browsers (or HTML < 5) only support HTTP GET and POST, but to communicate RESTful one need PUT and DELETE too. If the workaround should not be to use Ajax, something like a hidden form field is required to overwrite the actual HTTP method. Rails uses the following trick: <input name="_method" type="hidden" value="put" /> Is there a possibility to do something similar with JAX-RS? 回答1: Not strictly a JAX-RS solution but spring 3.0 comes with a HiddenHttpMethodFilter that implements

“jquery.jsonp.js” GET works. What about POST PUT DELETE OPTIONS?

杀马特。学长 韩版系。学妹 提交于 2019-12-19 11:52:43
问题 jsonp http methods besides GET (POST, PUT, OPTIONS, DELETE) Using jquery built-in $.ajax method looks like this $(document).ready(function() { $.ajax({ type: "GET", url: "http://myurl.com/webservice&callback=?", ... }); Only want to draw attention to the line type: "GET", With $.ajax performing a http PUT would be simply change type: "PUT", This code example comes from JSON parsing from cross domain using jquery ajax Not using $.ajax Using google-code's jquery.jsonp https://github.com

Use DELETE form method in Html.BeginForm()?

别来无恙 提交于 2019-12-19 06:26:19
问题 I'd like to use the appropriate HTTP method when possible. In this case, when a button is clicked to delete something, I want to fire the controller action with the attribute [HttpDelete] . However, I can't seem to create a form with this method - using Razor syntax. The FormMethod enum does not have an option for Delete and doing the following doesn't override it: @using (Html.BeginForm("Order", "Users", FormMethod.Post, new { method = "DELETE" })) Searching for solutions yields none, is

Fine Grained rest HTTP verbs browser support

假如想象 提交于 2019-12-18 03:32:22
问题 Is there any data regarding how browsers actually support rest http verbs (especially PUT, DELETE). This question is mostly motivated by the fact that many sources (such as this stackoverflow answer) inform that most browsers don't suport PUT and DELETE but don't say which. Rails solves this using a patch on the client, and reversing the patch on the server, but I wonder, for instance, which browsers wouldn't need such hack. 回答1: When in doubt, ask Anne: http://annevankesteren.nl/2007/10/http

Why does a cross-origin HEAD request need a preflight check?

风流意气都作罢 提交于 2019-12-17 07:37:48
问题 I was reading the spec on CORS requests, and I found this about preflight requests: These are requests to a non same origin URL with an HTTP request method other than GET that first need to be authorized using either a preflight result cache entry or a preflight request. I had thought the purpose of preflight requests was to check whether a request was allowed before making it, in case it (illegitimately) changed server state . But HEAD and OPTIONS don't modify server state. I must

RESTful Alternatives to DELETE Request Body

给你一囗甜甜゛ 提交于 2019-12-17 07:03:29
问题 While the HTTP 1.1 spec seems to allow message bodies on DELETE requests, it seems to indicate that servers should ignore it since there are no defined semantics for it. 4.3 Message Body A server SHOULD read and forward a message-body on any request; if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request. I've already reviewed several related discussions on this topic on SO and beyond, such as: Is an

RESTful Alternatives to DELETE Request Body

喜你入骨 提交于 2019-12-17 07:03:14
问题 While the HTTP 1.1 spec seems to allow message bodies on DELETE requests, it seems to indicate that servers should ignore it since there are no defined semantics for it. 4.3 Message Body A server SHOULD read and forward a message-body on any request; if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request. I've already reviewed several related discussions on this topic on SO and beyond, such as: Is an

Payloads of HTTP Request Methods

泄露秘密 提交于 2019-12-17 07:00:48
问题 The Wikipedia entry on HTTP lists the following HTTP request methods: HEAD: Asks for the response identical to the one that would correspond to a GET request, but without the response body. GET: Requests a representation of the specified resource. POST: Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. PUT: Uploads a representation of the specified resource. DELETE: Deletes the specified resource. TRACE: Echoes

REST API - PUT vs PATCH with real life examples

丶灬走出姿态 提交于 2019-12-17 02:51:48
问题 First of all, some definitions: PUT is defined in Section 9.6 RFC 2616: The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server . If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can