I am debugging some code in the Selenium-rc proxy server. It seems the culprit is the HttpURLConnection object, whose interface for getting at the HTTP headers does not cope with duplicate ... |
Im trying to improve the Java Html Document a little but i'm running into problems with the HttpUrlConntion. One thing is that some servers block a request if the user agent ... |
I am trying to download a file from my Java application. But because UrlConnection uses HTTP 1.1 protocol i get a Tranfer Encoding: chunked response in which case i can not ... |
Is it possible to send a Http header via a URL connection in java? I had this working using sockets, but ran into issues with a firewall which don't seem to ... |
I try to create the simplest Simplest WebServer and Client using HTTP. (Please, don't tell me to using Apache HTTPClient).
Client: try to PUT some file to Server.
// **PUT**
if(REQUEST.toUpperCase().equals("PUT")) {
File ...
|
In an application I need to use Socket connections as well as Http requests/responses in Java, I have done some work with Tomcat but I think it handles only HTTP requests/responses.
I ... |
How do you do do an HTTP PUT? The class I'm using seems to think it is doing a PUT but the endpoint is treating it as if I did a ... |
|
I just wanted to know if any of you had any problems using java default HttpURLConnection class. Some kind of bug that made you switch to apache commons.
Or is it just ... |
I am trying to read the authorization header for an HTTP request (because I need to add something to it), but I always get null for the header value. Other headers ... |
I am trying to write a simple Http client application in Java and am a bit confused by the seemingly different ways to establish Http client connections, and efficiently re-use the ... |
hi all I'm writing a simple web crawling script that needs to connect to a webpage, follow the 302 redirects automatically, give me the final url from the link and let ... |
Alright, so I have this bit of code, and when I make the request, I would like to include some HTTP Header info. How would I go about doing that?
public ...
|
I want to download the httpConnection class from apache but I cant find a link, also need to know how to import it and where to put the class files when ... |
I'm using URL.openConnection() to download something from a server. The server says
Content-Type: text/plain; charset=utf-8
But connection.getContentEncoding() returns null. What up?
|
I am successfully using this code to send HTTP requests with some parameters via GET method
function void sendRequest(String request)
{
// i.e.: request = "http://example.com/index.php?param1=a¶m2=b¶m3=c";
...
|
I am trying to do a put statement with a partial representation of a xml file from a java client by using a http put statement and passing a String partialXml
I ... |
I'm trying to open a connection:
HttpPost hp = new HttpPost();
HttpParams rp = new BasicHttpParams();
HttpClientConnection hc = new DefaultHttpClientConnection();
HttpContext hctx = new BasicHttpContext();
hp.setURI(new URI(baseUrl + "/login.jsp"));
rp.setParameter("os_username", username);
rp.setParameter("os_password", password);
rp.setParameter("os_destination", "/secure");
hp.setParams(rp);
HttpResponse response = httpexecutor.execute(hp, ...
|
I've written a Java program which scrapes some content from a web page. It retrieves the content by calling the readWebPage method every couple of seconds. The problem I'm having is ... |
I'm interested if it is possible to send HTTP GET headers with Java.
Basically I'm working on a Java program that interfaces with a REST-like web-service. To mimic this I've created a ... |
I am currently getting a webpage using java URL, however it is being redirected to the mobile version of the site.
Is there a way to mimic the browser so I get ... |
I'm unit testing my Java/Jersey web service and running into an interesting test case. I'm checking the status codes of different URI entries to make sure that incorrect URIs won't ... |
im trying to post 3 values into 3 textfields within a webpage form.
Just want to know maybe what im doing wrong?
Please correct me where im wrong.
This is the form code
<form ...
|
I use Apache http client 4.1 and always close the response InputStream (e.g. by calling EntityUtils.consume(response.getEntity)) after the HttpGet execution.
Now I wonder whether the connection is properly released if the HttpGet ... |
I tried to set the User Agent for http request like this:
public BufferedReader readURL(String url){
URL urlcon;
...
|
I have a Singleton Class to connect to http server. But the user can change the connection Host and Port. What is the best (most correct) way to update my singleton ... |
I'm using the following code to open a http connection in java:
URL url = new URL("http://stackoverflow.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("GET");
conn.setRequestProperty("Host", "Test:8080");
conn.getOutputStream();
However calling conn.setRequestProperty("Host", "Test:8080") appears ... |
We have an external system (not under my control) which has a Http Service running on it and we can invoke the service using Java's HttpURLConnection object. Now, for ... |
|
Hi, 1) I tried both GET as well as POST. It did not work. 2) is it possible for a webserver to know wheather a http request received by it has been made from a browser or from an application ? 3) is that a right piece of code for what I am looking for ? Thanks |
This is interesting and confusing for a couple reasons. For one, we often talk about web server sessions. The server maintains some state and remembers the user and what they're doing and that sounds a lot like the definition of a connection. The distinction is that web servers build their session stuff on top of the HTTP protocol, and session is ... |
|
|
|
|
|
|
|
I have a servlet that recives http header information from a client program. Now I have observed that when I assign a string value (including empty string ) in conn.addRequestProperty(), then the program works good. But, when I assign a null as any header value, then even the next header value displays a null even if I have assigned a value ... |
|
Hi All, I am working on posting multiple request to a server using HTTPClient . First i create a HTTPConnection (http://www.innovation.ch/java/HTTPClient/api/HTTPClient/HTTPConnection.html) and then send a post request. For every post thats made the HTTPResponse is read and processed. After i process the Response, i try to stop the connection, but it doesn't seem to work. Although it stops when i don't ... |
Hi, i'm having some trouble sending a byte array via http connection stream to servlet, here is my client code: byte[] bytes = ImageByteArray.getByteArrayFromImage(img); System.out.println(bytes.length); // this prints 167096 http = (HttpConnection) Connector.open("http://localhost:8080/Servlet/ImageServlet"); http.setRequestProperty("Content-Type", "multipart/form-data"); // i also tried image/jpg here http.setRequestMethod(HttpConnection.POST); os = http.openOutputStream(); os.write(bytes); and the servlet code: ServletInputStream in = request.getInputStream(); byte[] data = null; int chunkSize = ... |
|
Hi I seem to have messed up the understanding of java.net.URLConnection. Objective: I have 2 Webapps running on different servers. I want to transfer control from WebApp1 on Server1 to WebApp2 on Server2. A simple response.sendRedirect(dest) would ideally suffice but since i have a pretty large amount of data to be passed on from WebApp1 to WebApp2, i do not want ... |
|
To be honest, error 500 doesn't really help you much. It just means something went wrong while the request was being processed. So here it means your HTTP call was set up fine, the Axis service you're invoking was found ok and invoked, but something went wrong after that. Could be something wrong with your Axis call, or something wrong in ... |
|
Hello, I am trying to create a simple server/client application. I have a sample code that demonstrates such an application, but I am unable to open it correctly using eclipse. The code is in folders, and looks like this (xml style) As you can ... |
|
I have a jsp template that i want to call from my class using HTTPConnection. When i call this jsp page i want to pass an object to that jsp. This object would be used in the jsp and then the HTTPConnection returns the end HTML (kind of similiar to how a browser works).. How can i pass the object to ... |
|
I have a servlet that utilizes a BufferedReader to retrieve some data over an HttpURLConnection. There are a few negative behaviors I've found: 1) The calls are blocking -- while one thread waits for a response from the remote server, all incoming requests queue up. The remote server is often slow and this causes huge thread congestion on the servlet container. ... |
Im trying to run an applet on the remote server and it throws me this error Java Plug-in 1.6.0_01 Using JRE version 1.6.0_01 Java HotSpot(TM) Client VM User home directory = C:\Users\VSAG c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging ... |
I am getting a round trip time of 25 seconds on a mobile device(Nokia E70) while the same code gives 4 seconds RTT on an emulator(WTK standard emulator). I captured the packets bing exchanged and found that around 20 secs are taken by arp (who is) packets. Once the connection is established it takes 4 secs to download the data. Are ... |
|
someone please help me fix this problem it wont let me on yahoo to play spades i keep getting connetction failed and a red x Ahhh this problem. This problem is Yahoo related. Complain to yahoo. Your error is not a URL failure (as you implied in the other thread) but a ClassNotFound error. So complain to yahoo. Also you should ... |
when i try to run it, i get [#document: null] in the console, is there any way to check whether the DOMreader is connecting to the website? it should return a value of "This is something". i've tried the HTMLParser project but for longer websites it gave me tags that wern't in the source code! can anyone recomend a reliable and ... |