You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Pasquiers Gwenhael <gw...@Devoteam.com> on 2009/06/09 17:12:29 UTC

[NIO HttpCore user] sending requests

Hi,

We are currently using HttpCore (non-NIO) in some test application; we
have a growing number of connection so I'm trying to use the http.nio
libraries instead.

FYI, this tool "executes" XML script describing http callflows.


I hope I'll be clear enough:

For now I'm doing the client side, I'm using :

DefaultConnectingIOReactor
  - DefaultClientIOEventDispatch 
      - BufferingHttpClientHandler
          - HttpProcessor (custom, does nothing)
          - HttpRequestExecutionHandler (custom)

I do manage to establish a connection; i get a call to
HttpRequestExecutionHandler.submitRequest(...) and if I, for testing
I return a request there it sends it, nice.

However when I establish this connection I do not know yet the requests
I will have to send, so I have to return null in submitRequest(...);
then submitRequest() isn't called anymore by the lower layers.

My problem is that I did not find how to trigger that event latter
in order to send my requests once I know what they are. Or any other
way to send requests when "I" want to.

I don't know if I'm going the wrong way (not using the right classes?)
or if it is in fact something that is not that simple.

Thanks in advance for your help.

Gwenhaël PASQUIERS

DEVOTEAM / BU Telecom / Developer
Email : gwenhael.pasquiers@devoteam.com 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [NIO HttpCore user] sending requests

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, Jun 09, 2009 at 05:12:29PM +0200, Pasquiers Gwenhael wrote:
> Hi,
> 
> We are currently using HttpCore (non-NIO) in some test application; we
> have a growing number of connection so I'm trying to use the http.nio
> libraries instead.
> 
> FYI, this tool "executes" XML script describing http callflows.
> 
> 
> I hope I'll be clear enough:
> 
> For now I'm doing the client side, I'm using :
> 
> DefaultConnectingIOReactor
>   - DefaultClientIOEventDispatch 
>       - BufferingHttpClientHandler
>           - HttpProcessor (custom, does nothing)
>           - HttpRequestExecutionHandler (custom)
> 
> I do manage to establish a connection; i get a call to
> HttpRequestExecutionHandler.submitRequest(...) and if I, for testing
> I return a request there it sends it, nice.
> 
> However when I establish this connection I do not know yet the requests
> I will have to send, so I have to return null in submitRequest(...);
> then submitRequest() isn't called anymore by the lower layers.
> 
> My problem is that I did not find how to trigger that event latter
> in order to send my requests once I know what they are. Or any other
> way to send requests when "I" want to.
> 

IOControl#requestOutput() will cause the event to re-fire. The IOControl
interface is implemetned by all non-blocking connection classes and its
instances are thread safe.

Here is an example that demonstrates a simple strategy for managing
non-blocking connections on the client side using HttpCore API.

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpClientConnManagement.java

Hope this helps

Oleg


> I don't know if I'm going the wrong way (not using the right classes?)
> or if it is in fact something that is not that simple.
> 
> Thanks in advance for your help.
> 
> Gwenha?l?PASQUIERS
> 
> DEVOTEAM?/?BU?Telecom?/?Developer
> Email?:?gwenhael.pasquiers@devoteam.com 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org