get

Http Requests POST vs GET

自古美人都是妖i 提交于 2019-11-29 11:53:07
I am using a lot of HTTP Requests in an application that I am writing which uses OAuth. Currently, I am sending my GET and POST requests the same way: HttpConnection connection = (HttpConnection) Connector.open(url + connectionParameters); connection.setRequestMethod(method); connection.setRequestProperty("WWW-Authenticate", "OAuth realm=api.netflix.com"); int responseCode = connection.getResponseCode(); And this is working fine. I am successfully POSTing and GETing. However, I am worried that I am not doing POST the right way. Do I need to include in the above code the following if-statement?

How to get current seed from C++ rand()?

那年仲夏 提交于 2019-11-29 11:49:28
问题 I generate a few thousand object in my program based on the C++ rand() function. Keeping them in the memory would be exhaustive. Is there a way to copy the CURRENT seed of rand() at any given time? This would give me the opportunity to store ONLY the current seeds and not full objects. (thus I could regenerate those objects, by regenerating the exact same sub-sequences of random numbers) An exhaustive solution is storing the full sequence of random numbers given by rand() - doesn't worth it.

HttpURLConnection GET request getting 400 Bad Request

限于喜欢 提交于 2019-11-29 11:44:53
I am trying to do a GET request with some parameters in Java using HttpURLConnection. Everytime I do this however, I get a 400: Bad Request each time. What do I need to change to make it work? String url = "http://www.awebsite.com/apath?p1=v1&p2=v2&p3=v3"; HttpURLConnection conn = (HttpURLConnection)new URL(url).openConnection(); conn.setDoInput(true); conn.setDoOutput(false); conn.setUseCaches(false); conn.setRequestMethod("GET"); conn.setRequestProperty("Host", "www.awebsite.com"); conn.setRequestProperty("User-Agent", "Mozilla/4.0"); conn.setRequestProperty("Accept", "text/html,application

Error with jQuery get of a CSV file

[亡魂溺海] 提交于 2019-11-29 11:37:59
Here is my relevant jQuery code: $.get('sampleData.csv', function(data) { var lines = data.split('\r\n'); The first few line of the sampleData.csv file look like this: 2009,0,2,29.0000 2009,0,6,655.6200 I get 2 errors. On the first line of csv file I get the error syntax error On the 2nd line of code I get the error data.split is not a function What am I doing wrong? ETA According to the firebug console, the responseText is the following: 2009,0,2,29.0000\r\n2009,...\r\n2011,10,30,494.3500\r\n ETA I added an alert of the data before I try splitting it into lines, and I get the following:

Executing javascript in java - Opening a URL and getting links

偶尔善良 提交于 2019-11-29 11:31:15
import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import java.io.FileReader; public class Main { public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("js"); try { FileReader reader = new FileReader("C:/yourfile.js"); engine.put("urlfromjava", "http://www.something.com/?asvb"); engine.eval(reader); reader.close(); } catch (Exception e) { e.printStackTrace(); } } } Right now, the yourfile.js contains this line function urlget(url) { print("URL:"+url); var loc = window.open(url);

GET request for redirect initiated by browser but not successful

蹲街弑〆低调 提交于 2019-11-29 11:25:22
While trying to redirect user to a URL, it works with GET requests but not with postback requests. Through firebug's Network window, I can see the redirect response received by browser after the postback request (that should cause redirect) completes. The browser seemingly initiates a GET request for the redirect URL but doesn't actually successfully redirect. It remains there on the same page. I use JSF server side. The initiated GET request is not received at all by the server. However initiated by the browser on server's demand. I guess problem is somewhere client side only Can anyone

After HTTP GET request, the resulting string is cut-off - content has been consumed

对着背影说爱祢 提交于 2019-11-29 11:07:58
I'm making a http get request like this: try { HttpClient client = new DefaultHttpClient(); String getURL = "http://busspur02.aseag.de/bs.exe?SID=5FC39&ScreenX=1440&ScreenY=900&CMD=CR&Karten=true&DatumT="+day+"&DatumM="+month+"&DatumJ="+year+"&ZeitH="+hour+"&ZeitM="+min+"&Intervall=60&Suchen=(S)uchen&GT0=Aachen&T0=H&HT0="+start_from+"&GT1=Aachen&T0=H&HT1="+destination+""; HttpGet get = new HttpGet(getURL); HttpResponse responseGet = client.execute(get); HttpEntity resEntityGet = responseGet.getEntity(); if (resEntityGet != null) { //do something with the response Log.i("GET RESPONSE"

How to change the querystring when I submit my GET form using JQuery?

折月煮酒 提交于 2019-11-29 10:57:11
Suppose that I have a simple form in my page like this : <form action="/properties/search" method="GET" id="form_search"> <p> <label for="price">Min price:</label> <input type="text" name="min_price" id="min_price"> </p> <p> <label for="price">Max price:</label> <input type="text" name="max_price" id="max_price"> </p> <p> <input type="submit"> </p> </form> When I submit my form, I have the following url : http://.../properties/search?min_price=100000&max_price=200000 I want to change this url to have : http://.../properties/search?price=100000,200000 To do that, I'm using JQuery and the JQuery

difference between cin.get() and cin.getline()

两盒软妹~` 提交于 2019-11-29 10:54:51
I am new to programming, and I have some questions on get() and getline() functions in C++. My understanding for the two functions: The getline() function reads a whole line, and using the newline character transmitted by the Enter key to mark the end of input. The get() function is much like getline() but rather than read and discard the newline character, get() leaves that character in the input queue. The book(C++ Primer Plus) that I am reading is suggesting using get() over getline() . My confusion is that isn't getline() safer than get() since it makes sure to end line with '\n' . On the

GET vs. POST (form processing)

爷,独闯天下 提交于 2019-11-29 10:46:25
I completely understand the differences between the two in terms of form handling, user discretion and privacy of data, but in what situation would anyone rather use GET over POST when sending form results? Thanks GET places parameters in the URL itself, allowing everyone to see. While POST would be ideal for logins and security-sensitive data, GET is ideal when you want a dynamic page to be bookmarked. Take a forum for example. The thread which shows all posts within it is loaded dynamically. There doesn't exist a page for every thread available, meaning parameters must be provided which