Roland et al,
Sorry to take such a long time between requests for help. Before I make major
changes to my application, how can I test to see whether I can still use the
httpclient "simple connection" and mimic the sequential requests as you suggest
or whether I really need a multithreaded connection?
Thanks
Jerry
-----Original Message-----
From: [EMAIL PROTECTED]
To: [email protected]
Sent: Sat, 13 Jan 2007 1:54 PM
Subject: Re: How to "mimic a browser" for threaded web sites?
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
________________________________________________________________________
AOL now offers free email to everyone. Find out more about what's free from
AOL at AOL.com.