http-post

URL parameters are not being passed by curl POST

萝らか妹 提交于 2019-11-28 12:44:07
This is my java code: @POST @Path("/sumPost") @Produces(MediaType.TEXT_PLAIN) public String sumPost(@QueryParam(value = "x") int x, @QueryParam(value = "y") int y) { System.out.println("x = " + x); System.out.println("y = " + y); return (x + y) + "\n"; } I call it like this: curl -XPOST "http://localhost:8080/CurlServer/curl/curltutorial/sumPost" -d 'x:5&y:3' The problem is the System.out.println call keeps posting zero zero, it seems I am not passing x and y correctly. Update After the answer, I changed my request to: curl -d '{"x" : 4, "y":3}' "http://localhost:8080/CurlServer/curl

How do I access HTTP POST data from meteor?

时光怂恿深爱的人放手 提交于 2019-11-28 12:11:44
I have an Iron-router route with which I would like to receive lat/lng data through an HTTP POST request. This is my attempt: Router.map(function () { this.route('serverFile', { path: '/receive/', where: 'server', action: function () { var filename = this.params.filename; resp = {'lat' : this.params.lat, 'lon' : this.params.lon}; this.response.writeHead(200, {'Content-Type': 'application/json; charset=utf-8'}); this.response.end(JSON.stringify(resp)); } }); }); But querying the server with: curl --data "lat=12&lon=14" http://127.0.0.1:3000/receive Returns {} . Maybe params doesn't contain post

MVC - Editing a list of objects

偶尔善良 提交于 2019-11-28 12:07:02
I have the following class layout in MVC: public class ReportModel { List<SomeItem> items; string value; string anotherValue; } now I create a strongly typed view in MVC of this type and make editable text fields to edit each value as well as use a foreach loop to populate text fields to edit the items in the list of someitem. when I submit to the httppost method the singular values come back fine in the reportmodel object but the list does not get returned in the object. How should this be done? When I say httppost I am referring to the method that MVC is posting back to [HttpPost] public

Spring Rest: Cannot insert rows that have @ManyToOne column

半世苍凉 提交于 2019-11-28 11:42:36
问题 I am following a spring getting started tutorial in https://spring.io/guides/gs/accessing-data-rest/ I added another entity books that has @ManyToOne relation to Person entity. Person entity has a new property called bikes and has a @OneToMany relation with Bike entity. Only thing that is different from the getting started project is the new attribute with its getter and setter: package hello; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue;

jQuery post respond with readyState:0, status:0

限于喜欢 提交于 2019-11-28 11:13:57
all. I am using a jquery version 1.6.2. I do a ajax call like this: var jqxhr = $j.post(myPHP, function() { alert("success"); }) .success(function() { alert("second success"); }) .error(function(data) { alert(JSON.stringify(data)); }) .complete(function() { alert("complete"); }); The script, run, and show error, than, complete. Some people may thing that...myPHP have some problem, but the myPHP is always show: {"sayHi":"hihi"} So, I go to firebugs to check whether the link have any problem, when I called..: It show me the POST url with status 200, which is ok. Also, I can see the respond via

Selenium: Trying to log in with cookies - “Can only set cookies for current domain”

青春壹個敷衍的年華 提交于 2019-11-28 10:59:08
What I am trying to achieve I am trying to log in to a website where cookies must be enabled using Selenium headless, I am using PhantomJS for driver. Problem I first recorded the procedure using Selenium IDE where it works fine using Firefox (not headless). Then I exported the code to Python and now I can't log in because it's throwing an error saying "Can only set Cookies for the current domain". I don't know why I am getting this problem, am I not on the correct domain? Code from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import

Problems with a Build_HttpBody() // httpPost.setEntity() - Android

泪湿孤枕 提交于 2019-11-28 10:29:37
问题 I develop AndroidApps with AndroidStudio I start to do a simple HttpPost Request and I had a problems, all post that I could find do this: private void CheckLoguin_Request(String User, String Pass){ //Declaration of variables HttpClient httpClient = new DefaultHttpClient(); HttpPost Request = new HttpPost(url_Loguin); HttpResponse Response; List<NameValuePair> BodyRequest_Elements = new ArrayList<NameValuePair>(); BodyRequest_Elements.add(new BasicNameValuePair("user_name", User));

Android Volley - Post Request - Not Working Online

◇◆丶佛笑我妖孽 提交于 2019-11-28 09:17:43
问题 I was trying to make a POST request through Volley. It is working totally fine in my localhost but when i moved it to webserver the response is empty. Java Code RequestQueue queue = Volley.newRequestQueue(this); StringRequest sr = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { @Override public void onResponse(String response) { pd.dismiss(); Log.d("Response: ", response.toString()); } }, new Response.ErrorListener() { @Override public void onErrorResponse

Enable CORS AngularJS to send HTTP POST request

Deadly 提交于 2019-11-28 09:05:29
I want to send an HTTP POST request by submitting a form to my server, which is located at a different domain (enabled cors in the server script using node.js). This is the script where all the Angular configurations are : var myApp = angular.module('myApp', ['ngRoute']); myApp.config(function($routeProvider, $locationProvider, $httpProvider) { $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; $routeProvider .when('/', { controller: 'RouteCtrl', templateUrl: 'views/home_views.html' }) .when('/login', { controller: 'RouteCtrl',

Why is my Asp.Net Form arriving empty when I post from Page to Page?

只愿长相守 提交于 2019-11-28 08:47:37
问题 I have the following HTML Code <%@ Page Language="C#" %> <html> <head> <title></title> </head> <body> <form id="frmSystem" method="post" action="target.aspx"> <input id="txtTextField" type="text" /> <input id="btnPost" value="Submit" onclick="javascript:frmSystem.submit();" type="button" /> </form> </body> </html> The target Page is coming up but the form that it is receiving is empty. I have a break point on my target.aspx page and while I can see a form, it's keys are empty and Request[