hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jyu...@aol.com
Subject Re: How to "mimic a browser" for threaded web sites?
Date Sun, 08 Apr 2007 17:14:02 GMT
 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
 -----Original Message-----
 From: http-async@dubioso.net
 To: httpclient-user@jakarta.apache.org
 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:


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,

To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

AOL now offers free email to everyone.  Find out more about what's free from AOL at AOL.com.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message