httpclient « connection « Java Network Q&A

Java Network Q&A
Java Network Q&A » connection » httpclient 

1. With Apache HttpClient, why isn't my connection timeout working?

My implementation of httpclient occasionally throws an exception when calling doGetConnection(). However, I have the following timeout set

it looks almost like my timeout is not being picked up. Is there anywhere ...

2. httpclient vs httpurlconnection

Wich are the main differences between the two? thanks

3. Force connection to close with HttpClient in WCF

We're using the HttpClient class from "Rest toolkit" for WCF ( ) to inteface a Rest-server we've created. The server currently always close the connection, regardless of the ...

4. HttpClient ThreadSafeClientConnManager throws "Connection reset"

I define HttpClient in 2 different ways: 1. Plain vanilla: client = new DefaultHttpClient(); 2. Thread safe:

DefaultHttpClient getThreadSafeHttpClient() {
    HttpParams params = new BasicHttpParams();

5. How do I count the number of 100 Continues the server sent me?

I am using Apache Commons HttpClient 3.1, and I found that HttpURLConnection from Sun drops the 100 Continues from the stream. So therefore I don't seem able to get the 100 Continue ...

6. How to make the http connection timeout/disconnected after a time interval?

I am new in apache HttpClient, I used the following code to get the http connection timeout (disconnected) after certain time interval:

PostMethod method = new PostMethod(authURL);
HttpClient client = new HttpClient();
HttpClientParams params= ...

7. How can I reuse a HttpClient connection efficiently?

I am doing HTTP POSTs very frequently (>= 1/sec) to an API endpoint and I want to make sure I'm doing it efficiently. My goal is to succeed or fail as ...

8. Apache HttpClient CoreConnectionPNames.CONNECTION_TIMEOUT does nothing?

I get strange behavior from HttpClient with parameter CoreConnectionPNames.CONNECTION_TIMEOUT set to 1. I would expect that HttpGet request would fail, throwing connection timeout exception and yet they are successful. This seems irrational ...

9. Apache httpclient makes lots of connections

I'm using apache httpclient 4.0 to connect to a video stream (motion jpeg) over http. Here's my code:

DefaultHttpClient client;

HttpParams params = new BasicHttpParams();

List<String> authpref = new ArrayList<String>();

params.setParameter("http.auth.proxy-scheme-pref", authpref);
params.setParameter("http.protocol.handle-authentication", Boolean.TRUE);

SchemeRegistry schemeRegistry = ...

10. HttpClient: how do I obtain the underlying socket from an existing connection?

I am using HttpClient 4.02 to create a connection via proxy (using the CONNECT method) to tunnel a connection to a remote server. HttpClient is very convenient for this but I ...

11. Problem simulating HTTP POST using HttpClient

I am trying to programatically send a HTTP Post request using HttpClient to but it is not liking the request I send it. I copied the headers and ...

12. HttpClient 4.0.1 - how to release connection?

I have a loop over a bunch of URLs, for each one I'm doing the following:

private String doQuery(String url) {

  HttpGet httpGet = new HttpGet(url);
  setDefaultHeaders(httpGet); // static method

13. Java server self-signed certificate + client certificate and SSL - connection reset

(I've already asked the similar question and it turns out that my client key wasn't getting loaded, but I only got one exception further so I'm posting another question.) I'm connecting ...

14. how to wait connection?

I always got

java.lang.IllegalStateException: Invalid use of SingleClientConnManager: connection still allocated. Make sure to release the connection before allocating another one.
Exception.I tried to use ...

15. Apache HTTPClient throws Connection reset for many domains

I'm creating a (well behaved) web spider and I notice that some servers are causing Apache HttpClient to give me a SocketException -- specifically: Connection reset
The code that causes this is:
// ...

16. No buffer space available (maximum connections reached?): connect

Hi I am using Apache HTTP Client 4.0 to upload some files on a server based on HTTPS protocol. The uploaded application is running 24x7. Today suddenly it started to throw ...

17. WCF HttpClient poll ContentReadStream on an open connection?

I'm connecting with a WCF HttpClient to a node.js http server (express). Server-side I keep the connection open and stream data to the client. How can I poll the ContentReadStream client-side? ...

18. Releasing connection of HttpClient 4.1.x for sequential execution with one HttpClient instance

I'm sorry for a little duplication, here, here, but they say, that if you read the the last byte of the body of response and close the input stream. ...

19. Number of hits while loading a webpage?

While loading a web page I want to calculate number of hits to the server(Number of requests and and number of responses). For example while loading how many times ...

20. Should use of be discouraged as org.apache.http.client.HttpClient is way better ?

I still see people use HttpURLConnection for communicating with the websites. This forum also have many issues related to HttpURLConnection. Now, HttpClient from apache can achieve almost everything which HttpURLConnection can, ...

21. Handling multiple requests over a single connection using httpcomponents?

I want to use a single connection to communicate with a client device. I am having problems keeping the connection alive. I'm using DefaultConnectionReuseStrategy() which returns false for keepAlive() after each request ...

22. Apache HTTPClient does not make more than 2 connections

I've been trying to implement connection pooling for my application using Apache HTTPClient (v4.1). The problem is that the client always makes only two connections when run, though there are enough ...

23. HttpUrlConnection#setReadTimeout has no effect when POSTing large messages

I have a problem where an external HTTP server that I need to POST large messages to is having OutOfMemory issues. My HTTP client code is not timing out. It is possible ...

24. How do I set a connection timeout in Apache http client?

I want to run thread safe, asynchronous HTTP requests using HTTPClient. I noticed that it does not respect my CONNECTION_TIMEOUT argument. The code is ColdFusion / Java hybrid.

client = loader.create("org.apache.http.impl.nio.client.DefaultHttpAsyncClient").init();
CoreConnectionPNames ...

25. HTTP client-server, I don't think i'm closing my client side connections with BasicResponseHandler()

I have a server implemented using Apache HTTPCore which can accept posts from an httpclient implementation. I have enough of it working so that I can send to the server, processes ...

26. HTTPClient 4.x Connection reuse not happening

I tried the following example of Apache http client: I set the max pool size as 5 and run ten threads. After running this code, when I check netstat , ...

29. connection timed out with commons httpclient

Hi all, I'm trying to post to a website using the apache common httpclient util and I'm using borrowed code from the net to power my app, when I run my app, I get a connection time out error. my app is sitting behing a corporate proxy and I guess my app is not able to reach the website through the ...

30. Multiple request in single connection using HttpClient

Error 403 means "Forbidden". That usually means one of the following: 1) you forgot to login somewhere 2) the resource is only accessible if the referer is the same site (or one of the other allowed hosts) 3) you are not on the allowed hosts list, based on IP 4) you are explicitly blocked, based on IP My guess is the ...

31. Applet : httpclient Connection Timeout

Hi all, I wrote an applet that use httpclient to post string parameter to an ASP page. It works when i use client that connect directly on internet while on some client with Proxy no works and give me this error: Applet starting. 23-giu-2009 14.58.43 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry INFO: I/O exception ( caught when processing request: Connection timed out: connect 23-giu-2009 14.58.43 ...

32. HttpClient give Connection refused

method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); try { // Execute the method. int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { System.err.println("Method failed: " + method.getStatusLine()); } // Read the response body. byte[] responseBody = method.getResponseBody(); // Deal with the response. // Use caution: ensure correct character encoding and is not binary data System.out.println(new String(responseBody)); } catch (HttpException e) { System.err.println("Fatal protocol violation: ...  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.