How can I queue HTTP requests ?

Recommend this page to a friend!

      HTTP Client  >  All threads  >  How can I queue HTTP requests ?  >  (Un) Subscribe thread alerts  
Subject:How can I queue HTTP requests ?
Summary:Queue HTTP requests and results
Messages:4
Author:Christian Hernoux
Date:2012-10-24 10:48:12
Update:2012-10-27 23:08:44
 

  1. How can I queue HTTP requests ?   Reply   Report abuse  
Picture of Christian Hernoux Christian Hernoux - 2012-10-24 10:48:12
I want to read some Urls in file. Foreach urls, how can I queue HTTP requests and results (200, 404, etc..)

Thanks for your help.

  2. Re: How can I queue HTTP requests ?   Reply   Report abuse  
Picture of Juraj Puchký Juraj Puchký - 2012-10-24 11:26:58 - In reply to message 1 from Christian Hernoux
Prepare custom handler class

be sure that you have option httpClient.processRequestImmedietaly = false;
httpClient.skipWhenEverIsLocked = false;
httpClient.throwExceptionWhenEverIsLocked = false;

then add queries into queue with .get and .post method

after

while(httpClient.next()) {
// Count anything, handler will process data
}

Have a fun

  3. Re: How can I queue HTTP requests ?   Reply   Report abuse  
Picture of Aleksandr Aleksandr - 2012-10-27 18:06:45 - In reply to message 2 from Juraj Puchký
how get POST request?
httpClient.post('http://localhost/HTTP-client/', 'hello=hello', 'hello2=hello');
this code not work

  4. Re: How can I queue HTTP requests ?   Reply   Report abuse  
Picture of Juraj Puchký Juraj Puchký - 2012-10-27 23:08:44 - In reply to message 3 from Aleksandr
var params= new HTTPParams();
params.add('hello','hello');
params.add('hello2','hello');
// you can also update headers with changing
// httpClient.customHTTPHeaders = new HTTPHeaders();
// httpClient.customHTTPHeaders.add('key','value');

// or disable default headers with httpClient.useDefaultHeadersForPOST=false;


httpClient.post('http://localhost/HTTP-client/',params);
// in case httpClient.processRequestImmedietaly = false;

while(httpClient.next()) {
// Count
}

// or just simply
httpClient.next();
// To process it true is when is done