Dear,
I have problem about HTTP connection with SSL (called HTTPS). I use HttpClient 4.0 alpha 4. I use HttpClient with HTTPS connection to my website first and then I use HttpClient with HTTP connection to my website. The issue is that the first connection's cookie (session id) is different from the second connection's cookie. I am sure I use the same HttpClient object to connect to my website. So I guess it occurred because HTTPS and HTTP are different connection. I make an experiment on it. The test is on my localhost computer. Experiment 1 step 1: Connect with HTTPS first step 2: Reconnect with HTTP second Result debug log: http://tinypaste.com/37698 Experiment 2 step 1: Connect with HTTP first step 2: Reconnect with HTTP second Result debug log: http://tinypaste.com/d8a7e According to the result debug log, in the experiment 2, the HttpClient object will use the same connection with the same cookie in first connection to do the second connection, so that the session persists. But in experiment 1, the first cookie is different from second cookie, so that the session will not be persisted. Because I need to login my website with HTTPS (for security reason) and then browse it with HTTP (for performance reason), so I think HttpClient will cover this cookie issue for me. But the experiment says it's not as what I think. This is partial code I wrote: // some initial codes. // Create and initialize scheme registry SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register( new Scheme("http", PlainSocketFactory.getSocketFactory(), 3052)); schemeRegistry.register( new Scheme("https", sslSocketFactory, 8443)); // Create an HttpClient with the ThreadSafeClientConnManager. // This connection manager must be used if more than one thread will // be using the HttpClient. clientConnManager = new ThreadSafeClientConnManager(params, schemeRegistry); httpClient = new DefaultHttpClient(clientConnManager, params); // some executed codes. Is there any suggestion? Or I miss something wrong? Please give me a hand to solve this problem. Thank you in advance. Sincerely, Micky