http-method

Overwrite HTTP method with JAX-RS

若如初见. 提交于 2019-12-02 04:21:56
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? Not strictly a JAX-RS solution but spring 3.0 comes with a HiddenHttpMethodFilter that implements exactly the trick that rails does, defaults to the same _method parameter. Note that you don't need to be using

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

左心房为你撑大大i 提交于 2019-12-01 14:19:42
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/jaubourg/jquery-jsonp Here is an example of using jquery.jsonp.js with the GET method $.jsonp({ cache: false,

Use DELETE form method in Html.BeginForm()?

三世轮回 提交于 2019-12-01 03:42:29
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 nobody doing this? I know I can just use POST but isn't this the point of the HTTP delete method to begin

How to get the HTTP method in AWS Lambda?

帅比萌擦擦* 提交于 2019-11-30 18:53:20
In an AWS Lambda code, how can I get the HTTP method (e.g. GET, POST...) of an HTTP request coming from the AWS Gateway API? I understand from the documentation that context.httpMethod is the solution for that. However, I cannot manage to make it work. For instance, when I try to add the following 3 lines: if (context.httpMethod) { console.log('HTTP method:', context.httpMethod) } into the AWS sample code of the "microservice-http-endpoint" blueprint as follows: exports.handler = function(event, context) { if (context.httpMethod) { console.log('HTTP method:', context.httpMethod) } console.log(

How to get the HTTP method in AWS Lambda?

邮差的信 提交于 2019-11-30 03:18:54
问题 In an AWS Lambda code, how can I get the HTTP method (e.g. GET, POST...) of an HTTP request coming from the AWS Gateway API? I understand from the documentation that context.httpMethod is the solution for that. However, I cannot manage to make it work. For instance, when I try to add the following 3 lines: if (context.httpMethod) { console.log('HTTP method:', context.httpMethod) } into the AWS sample code of the "microservice-http-endpoint" blueprint as follows: exports.handler = function

How to detect HTTP method in CodeIgniter

烂漫一生 提交于 2019-11-30 03:13:18
How can I detect HTTP method in CodeIgniter controller class? Edited: Is there any other way than using $_SERVER['REQUEST_METHOD'] in CodeIgniter? Sgn. Thanks to Branden, I've found the answer. $this->input->server($index) is identical to $_SERVER[$index] . To get method you can use: $this->input->server('REQUEST_METHOD') . UPDATE: (thanks to Ecir Hana ) As of CodeIgniter 3, using of method is also possible: echo $this->input->method(TRUE); // Outputs: POST echo $this->input->method(FALSE); // Outputs: post echo $this->input->method(); // Outputs: post In CodeIgniter 3, you can use the method

Is it possible to implement X-HTTP-Method-Override in ASP.NET MVC?

我与影子孤独终老i 提交于 2019-11-29 07:41:41
I'm implementing a prototype of a RESTful API using ASP.NET MVC and apart from the odd bug here and there I've achieve all the requirements I set out at the start, apart from callers being able to use the X-HTTP-Method-Override custom header to override the HTTP method. What I'd like is that the following request... GET /someresource/123 HTTP/1.1 X-HTTP-Method-Override: DELETE ...would be dispatched to my controller method that implements the DELETE functionality rather than the GET functionality for that action (assuming that there are multiple methods implementing the action, and that they

Using Spring Security, how can I use HTTP methods (e.g. GET, PUT, POST) to distingush security for particular URL patterns?

本秂侑毒 提交于 2019-11-29 03:32:44
The Spring Security reference states: You can use multiple elements to define different access requirements for different sets of URLs, but they will be evaluated in the order listed and the first match will be used. So you must put the most specific matches at the top. You can also add a method attribute to limit the match to a particular HTTP method (GET, POST, PUT etc.). If a request matches multiple patterns, the method-specific match will take precedence regardless of ordering. How can I configure Spring Security so that access to particular URL patterns are secured differently depending

Is the HTTP method PURGE idempotent in Varnish?

谁说我不能喝 提交于 2019-11-28 14:17:01
Is the HTTP verb PURGE idempotent? If I send the same PURGE request twice will I receive 200 the second time? I have a microservice that invalidates a Varnish cache before publishing a message into a rabbit queue. In case of purge failure our need is to just log and continue the execution. The queue consumer has to get the latest status of the resource from the Varnish cache. Will a new purge request (before actually requesting the resource from varnish) from the second microservice return success in case the first purge from the first microservice succeeded? PURGE is not a standard HTTP

Rails Responds with 404 on CORS Preflight Options Request

大兔子大兔子 提交于 2019-11-28 09:35:18
I'm creating a set of services using Rails 4, which I am consuming with a JavaScript browser application. Cross-origin GETS are working fine, but my POSTs are failing the preflight OPTIONS check with a 404 error. At least, I think that's what's happening. Here are the errors as they appear in the console. This is Chrome 31.0.1650.63 on a Mac. OPTIONS http://localhost:3000/confessor_requests 404 (Not Found) jquery-1.10.2.js:8706 OPTIONS http://localhost:3000/confessor_requests No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore