Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 87286 invoked from network); 13 Jan 2007 18:51:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jan 2007 18:51:36 -0000 Received: (qmail 38391 invoked by uid 500); 13 Jan 2007 18:51:42 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 38379 invoked by uid 500); 13 Jan 2007 18:51:42 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 38363 invoked by uid 99); 13 Jan 2007 18:51:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jan 2007 10:51:42 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [212.227.126.186] (HELO moutng.kundenserver.de) (212.227.126.186) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jan 2007 10:51:32 -0800 Received: from [85.180.35.92] (helo=[85.180.35.92]) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), id 0ML29c-1H5nyA0E3I-0006jC; Sat, 13 Jan 2007 19:51:10 +0100 Message-ID: <45A92AF3.10802@dubioso.net> Date: Sat, 13 Jan 2007 19:54:43 +0100 From: Roland Weber User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20070102 SeaMonkey/1.0.7 MIME-Version: 1.0 To: HttpClient User Discussion Subject: Re: How to "mimic a browser" for threaded web sites? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:4601b1d39ab4ddfc21c613822e406392 X-Virus-Checked: Checked by ClamAV on apache.org Hi Jerry, long time no see. Our discussions were actually one of the triggers for writing the Client HTTP Programming Primer :-) > 1) go to the logon page > 2) enter user id and password > 3) an informational window appears asking the user to wait while his > financial information is being found > 4) the informational window disappears and a window comes up containing the > users financial balance > > I tried to mimic my browser the same way as I usually do, using an > httpclient "simple connection," but the httpclient log indicates that I will have to > use a multithreaded connection (because of step 3 above). I'm not sure that you will really need simultaneous connections. Maybe the windows just generate sequential requests, but target them to the other window. For example: 1. main window uses JavaScript to pop up informational window (request one) 2. informational window uses JavaScript to request financial information, but specifies the main window as the target for loading the page (request two) 3. the new page in the main window closes the popup window (no request at all) This could be mimicked with a single connection. But in case I'm wrong... The main problem will be that your application has to become multithreaded. This is a major change to an application design. I've searched for "Java Tutorial Threads", and these are some of the higher ranking hits: http://java.sun.com/docs/books/tutorial/essential/concurrency/ http://www.javaworld.com/javaworld/jw-04-1996/jw-04-threads.html http://www.cs.clemson.edu/~cs428/resources/java/tutorial/JTThreads.html Once you've got the multithreading basics covered, do the following: 1. use one thread per "browser window" 2. create a single HttpClient object, representing the "browser" 3. use the MultiThreadedHttpConnectionManager to create the HttpClient object It should be as simple as that. Your threads will have to do some interaction to simulate what the two windows in the browser will do to eachother. hope that helps, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org