httprequest

HttpWebRequest “POST” returning server error (Exception)

▼魔方 西西 提交于 2019-12-12 04:04:58
问题 I'm trying to call the google URL shortner API from a WP7 app, I tried first on a Console Application by doing this: var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"longUrl\":\"http://www.google.com/\"}"; Console.WriteLine(json); streamWriter.Write(json); }

I want to get information about how to read data from textView

China☆狼群 提交于 2019-12-12 03:39:05
问题 i am building an android app in this I want to get information how to read data from textView and to send an http request i was not able to figure out what is to be done to make it work. Following is the code that i have used in intent section which will get the data from Edit text . Intent summeryPage = new Intent(Form_section.this ,summry_page.class); // ((routernBoltBeam)this.getApplication()).setFirstName(FirstName); summeryPage.putExtra("fname",fName.getText().toString()); summeryPage

Javascript promise return [duplicate]

眉间皱痕 提交于 2019-12-12 03:37:42
问题 This question already has answers here : How do I return the response from an asynchronous call? (36 answers) Closed 4 years ago . I'm trying to make a function that returns the body of an api call using a promise. My code is function checkApi(link) { var promise = new Promise(function(resolve, reject) { //query api }); promise.then(function(value) { console.log(value); //want to return this, this would be the body }, function(reason) { console.log(reason); //this is an error code from the

How to fetch the actual request URL in Apache/PHP if it does not exist and user is redirected to 404 error page?

北城余情 提交于 2019-12-12 03:36:56
问题 I want to fetch the actual URL of the request made by the client, how do I do that? I mean if someone requests a page that does not exists, like, http://localhost/invalid.php , and I have set 404 custom error file to http://localhost/test.php , then how do I get to know what was the actual URL requested by the user. I have tried this in IIS7. I have set the Custom Error Page to /test.php, and whenever the user requests a URL which does not exist, I could still access that URL using $_SERVER[

Simple HTTPS GET from the AngelList API with NodeJS and Request

大城市里の小女人 提交于 2019-12-12 03:29:58
问题 I have managed to grant access from the user, thus to get the access_token as needed to retrieve the data from the Angellist API. The next step is to fetch the user data. As we can read from the Angellist API, you do this by authenticated HTTPS GET requests: Use the Token Any requests that require authentication must be made using HTTPS, with the access token provided in the HTTP Authorization header, request body or query string. AngelList only supports Bearer tokens, as defined in http:/

Testing a custom Grails TagLib method that uses request object

与世无争的帅哥 提交于 2019-12-12 03:09:30
问题 Total 'testing newbie' wanting to test the addJsFile method of my custom TagLib. What am I missing? TagLib: import com.company.group.application.helper.Util ... class MyTagLib { static namespace = 'mytag' def util ... def addJsFile = { if (util.isSecureRequest(request)) { out << '<script src="https://domain.com/jsfile.js"></script>' } else { out << '<script src="http://domain.com/jsfile.js"></script>' } } } Test (as far as I could get): import org.springframework.http.HttpRequest import com

F5 and CTRL+F5 cause different behaviour in concurrent requests processing

≯℡__Kan透↙ 提交于 2019-12-12 02:53:18
问题 Premise 1 : This question was marked as a duplicate of this one, where the accepted (only) answer is more or less that the browser is using the same HTTP connection for multiple requests, while the servlet container uses one thread per connection. This is half an answer here, I'm trying to understand why refresh and hard refresh have different behaviours. Clearly this is not a strictly Java question, still belongs to programming domain though: not a duplicate, not OT, imho. No need to close

How to make sure the Cookie is set before a new request is made?

倖福魔咒の 提交于 2019-12-12 02:50:01
问题 I have an issue that should be fixed on the server side, but a quick workaround on the client side would be acceptable. I need to make a JS call after the page is loaded and the http-only secure cookie is already set. I'm using window.onload event to call window.location.replace(), but even though the page is loaded with the SET-COOKIE HTTP response header, the new request doesn't send the cookie. How to make sure the Cookie is set before a new request is made? 回答1: A workaround that works

PhantomJS crashes when I open too many pages and ignores the last URL

ε祈祈猫儿з 提交于 2019-12-12 02:38:10
问题 System: Windows 8.1 64bit with binary from the main page, version 2.0 I have a .txt file with 1 URL per line, I read every line and open the page, searching for a specific url.match (changed domain for privacy reasons in the code) - if found,print the found JSON, abort request, unload page. My .txt file contains 12500 links, for testing purpose I split it into the first 10/100/500 urls. Problem 1: If I try 10 urls, it prints 9 and uses 40-50% cpu afterwards Problem 2: If I try 100 urls, it

Setting request response attributes in Spring REST environment

ⅰ亾dé卋堺 提交于 2019-12-12 02:24:37
问题 We have a Spring REST environment which is producing json response. Below is the code which is used to send the json response @GET @Path("/userinfo.json/{userid}") @Produces("application/json") public List<UserinfoBean> getUserAllInformation(@PathParam("userid") String userid) { return openServicesAPI.getUserAllInformation(userid); } Can anyone let me know how I can set the request/response attribute and if at all possible create an HTTPsession here. 回答1: Use @Context this will give you the