httpconnection

Send Xml string through POST method in java

北慕城南 提交于 2019-12-10 08:17:18
问题 I want to pass an xml string through POST method to an URL. I tried below snippet but it doesn't return anything disableCertificateValidation(); String url = "https://..url"; //https Properties sysProps = System.getProperties(); sysProps.put("proxySet", "true"); sysProps.put("proxyHost", "1.2.3.4"); sysProps.put("proxyPort", "80"); Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication("userid",

android - send parameters while uploading file

纵饮孤独 提交于 2019-12-09 19:34:43
问题 I've got this piece of code http://pastebin.com/VrMNuxcv which successfully uploads a file onto the server from my android. I'd like to , however to be able to send a couple of string parameters together with it. Could you please tell me, if possible, where exactly I need to do this in that piece of code and how? Thanks Andreas 回答1: I assume that you're in control of how the server processes the upload, i.e., you wrote the server code too??? If so, I simply use custom/private request

AS3 - how to shutdown tcp connection?

人盡茶涼 提交于 2019-12-08 12:52:28
AS3 program keeps connection open though URLLoader instance is closed using close() method. Is any way to shutdown connection immediately once data is loaded? Checking connection status from commandline using netstat command, it is showing as Eshtablished. Please suggest. URLLoader is a HTTP wrapper. You have to use HTTP stuff to get it done. In order to close the connection you would have to send the Connection: close HTTP header along with the webserver response. (Note that the default for most webservers is Connection: Keep-Alive , and it is the behaviour you are seeing). In order to send

Blackberry application works in simulator but not device

一笑奈何 提交于 2019-12-08 12:41:40
问题 I read some of the similar posts on this site that deal with what seems to be the same issue and the responses didn't really seem to clarify things for me. My application works fine in the simulator. I believe I'm on Bold 9000 with OS 4.6. The app is signed. My app makes an HTTP call via 3G to fetch an XML result. type is application/xhtml+xml. In the device, it gives no error. it makes no visual sign of error. I tell the try catch to print the results to the screen and I get nothing.

AS3 - how to shutdown tcp connection?

梦想与她 提交于 2019-12-08 04:36:20
问题 AS3 program keeps connection open though URLLoader instance is closed using close() method. Is any way to shutdown connection immediately once data is loaded? Checking connection status from commandline using netstat command, it is showing as Eshtablished. Please suggest. 回答1: URLLoader is a HTTP wrapper. You have to use HTTP stuff to get it done. In order to close the connection you would have to send the Connection: close HTTP header along with the webserver response. (Note that the default

Blackberry HttpConnection and query string

元气小坏坏 提交于 2019-12-08 02:15:01
问题 I've been having some trouble connecting to a uri when I append a query string... I always get back 400 http code... however when I try the browser, same url, everything goes smooth... This is what I have: String query = "q=hello"; byte[] queryBytes = query.getBytes(); Somewhere in my code I open an HttpConnection using the queryBytes like this: String uri = "https://www.google.co.ve/search" + "?" + new String(queryBytes); HttpConnection request = (HttpConnection) Connector.open(uri); request

how to use the HTTP range header in J2ME?

坚强是说给别人听的谎言 提交于 2019-12-07 14:32:09
问题 is it possible to use range header in HTTP with HTTP GET request? if yes than how? I just want to download bytes from server with specified bytes. i.e if I want to download bytes from 0 to 255. 回答1: See this sample code, HttpConnection connection = null; InputStream inputstream = null; try { connection = (HttpConnection) Connector.open(url); // Enter your URL here. //HTTP Request connection.setRequestMethod(HttpConnection.GET); connection.setRequestProperty("Content-Type","//text plain");

java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

☆樱花仙子☆ 提交于 2019-12-07 09:02:51
问题 I have a HTTP server in Android. I create a new thread for each of the HTTP requests as in the link mentioned: http://hc.apache.org/httpcomponents-core-ga/httpcore/examples/org/apache/http/examples/ElementalHttpServer.java. When I issue multiple GET requests, sometimes I am getting an exception like the following: 01-22 10:28:22.779: W/System.err(2019): java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) 01-22 10:28:22.779: W/System.err(2019): at libcore.io

Is HTTP PUT supported in J2ME?

时光怂恿深爱的人放手 提交于 2019-12-07 07:03:38
问题 I just noticed a strange thing in MIDP 2.0 API: The HttpConnection class apidocs make explicit references to methods GET, POST and HEAD, but no other methods. Does this mean that they are not supported? http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/io/HttpConnection.html I also tried checking the MIDP 2.0 spec, but couldn't find any hard facts about this. I can give this a try on some phone(s), but can't try them all. Does anyone know which HTTP methods are required to

Python requests/urllib3 raises 'httplib.BadStatusLine' error if called many times?

﹥>﹥吖頭↗ 提交于 2019-12-06 09:12:06
I have a python program which utilizes python requests. I want to be able to run this program many times sequentially. The code can execute on its own, and run without any errors. However, when I try to run it 100 times, it will raise this error eventually: ConnectionError: HTTPConnectionPool(host='192.168.100.1', port=80): Max retries exceeded with url: 'command' (Caused by <class 'httplib.BadStatusLine'>: '') There are many different commands that are called, and is not always the same command. I have put in a delay in between the GET requests, so I don't think that because it is getting