http-delete

Using PUT and DELETE methods in Spring MVC

断了今生、忘了曾经 提交于 2019-11-27 07:50:41
I'm trying to use RequestMethod.PUT and RequestMethod.DELETE in Spring MVC controller (version 3.0.2). There are three methods mapped with a URL in the Spring controller class as follows (PUT, GET and POST respectively, for the demonstration purpose only). @RequestMapping(method = {RequestMethod.PUT}, value = {"admin_side/Temp"}, headers = {"content-type=multipart/form-data"}) public String update(@ModelAttribute("tempBean") TempBean tempBean, BindingResult error, Map model, HttpServletRequest request, HttpServletResponse response) { if (ServletFileUpload.isMultipartContent(request)) { System

Asp.net WEB API - What problems could arise if I use POST instead of PUT and DELETE?

≡放荡痞女 提交于 2019-11-27 05:20:36
I'm just starting to use Web API and though I found it really easy to create the methods and some configurations I needed, now I run into a problem I don't know how to solve. Some of the applications that will consume my services are very old and don't support DELETE and PUT methods (j2me applications for example) I have found that it is possible to do some kind of method emulation by passing something like this : _method=DELETE|PUT However, I'm not really sure if Web API will be able to interpret this and besides, I don't have the faintest idea how to do it. For those reasons I'm thinking in

Deleting a resource using http DELETE

梦想与她 提交于 2019-11-27 05:02:07
问题 So, given that the DELETE verb in Http is idempotent, when I issue the following request, what should happen the second (or third, or fourth, etc...)? DELETE /person/123 The first time, the resource is deleted and I return a 204 (successful, no content). Should I return a 204 on subsequent calls or a 404 (not found)? 回答1: As HTTP requests in a stateless system should be independent, the results of one request should not be dependent on a previous request. Consider what should happen if two

How to make Apache Tomcat accept DELETE method

坚强是说给别人听的谎言 提交于 2019-11-26 20:57:28
问题 I'm working on a project of RESTful web services, i'm using Apache Tomcat and JAX-RS. I want to accept DELETE requests from client but whenever i send a DELETE request from Advanced REST client Chrome plugin it gives response code 403 Forbidden. So how can i make Apche Tomcat accept DELETE request? 回答1: Tomcat was blocking DELETE methods for me because of my CORS filters. I needed new filters registered in my web.xml file. Here's an example of a very permissive one: <filter> <filter-name

What REST PUT/POST/DELETE calls should return by a convention?

血红的双手。 提交于 2019-11-26 18:46:08
问题 According to the "REST ideology" what should be in the response body for a PUT/POST/DELETE requests? What about return codes? Is HTTP_OK enough? What is the reason for such conventions, if any? I've found a good post describing POST/PUT differences: POST vs PUT But it still doesn't answer my question. 回答1: Forgive the flippancy, but if you are doing REST over HTTP then RFC7231 describes exactly what behaviour is expected from GET, PUT, POST and DELETE. Update (Jul 3 '14): The HTTP spec

Body of Http.DELETE request in Angular2

南笙酒味 提交于 2019-11-26 15:23:35
问题 I'm trying to talk to a somewhat RESTful API from an Angular 2 frontend. To remove some item from a collection, I need to send some other data in addition to the removée unique id(that can be appended to the url), namely an authentication token, some collection info and some ancilliary data. The most straightforward way I've found to do so is putting the authentication token in the request Headers, and other data in the body. However, the Http module of Angular 2 doesn't quite approve of a

How do I enable HTTP PUT and DELETE for ASP.NET MVC in IIS?

老子叫甜甜 提交于 2019-11-26 14:25:05
I use HTTP PUT and DELETE in my ASP.NET MVC3 application. When I run it in local, every thing works correctly; But when I publish the application to the server, these methods do not work. Are there any special settings for enable a web server to support PUT and DELETE requests? I'm using shared hosting with IIS 7.5. UPDATE: I enable PUT and DELETE requests in IIS manager . PUT command work fine. But DELETE still not works. I create requests by jQuery : I'm in this page: http://domain.com/dashboard/edit-site/103323/links/ and my ajax call is: $.ajax({ // url: same as page-url, cache: false,

Why should you delete using an HTTP POST or DELETE, rather than GET?

梦想与她 提交于 2019-11-26 12:27:12
I have been working through Microsoft's ASP.NET MVC tutorials, ending up at this page http://www.asp.net/learn/mvc/tutorial-32-cs.aspx The following statement is made towards the bottom of this page: In general, you don’t want to perform an HTTP GET operation when invoking an action that modifies the state of your web application. When performing a delete, you want to perform an HTTP POST, or better yet, an HTTP DELETE operation. Is this true? Can anyone offer a more detailed explanation for the rationale behind this statement? Edit Wikipedia states the following: Some methods (for example,

How to send PUT, DELETE HTTP request in HttpURLConnection?

China☆狼群 提交于 2019-11-26 11:33:14
I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS requests but I still haven't found any sample code which successfully performs PUT and DELETE requests. Matthew Murdoch To perform an HTTP PUT: URL url = new URL("http://www.example.com/resource"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRequestMethod("PUT"); OutputStreamWriter out = new OutputStreamWriter( httpCon

Asp.net WEB API - What problems could arise if I use POST instead of PUT and DELETE?

吃可爱长大的小学妹 提交于 2019-11-26 11:31:09
问题 I\'m just starting to use Web API and though I found it really easy to create the methods and some configurations I needed, now I run into a problem I don\'t know how to solve. Some of the applications that will consume my services are very old and don\'t support DELETE and PUT methods (j2me applications for example) I have found that it is possible to do some kind of method emulation by passing something like this : _method=DELETE|PUT However, I\'m not really sure if Web API will be able to