hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: How to "mimic a browser" for threaded web sites?
Date Sat, 13 Jan 2007 18:54:43 GMT
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


Mime
View raw message