You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Adrian Cole <fe...@gmail.com> on 2009/06/26 13:33:30 UTC

Status tracking

Hello.

I am using http core NIO and investigating how to provide feedback on upload
(PUT/POST) and download (GET) entity enclosing requests.  Essentially, I'd
like to know when a certain number of the overall bytes have been
transmitted/consumed.  Do you have any strategies for this for NIO?

Thanks,
Adrian Cole
jclouds <http://code.google.com/p/jclouds>

Re: Status tracking

Posted by Adrian Cole <fe...@gmail.com>.
Interesting perspective, Oleg.  I think I have something I can work with
here.  Thanks for the advise.

-Adrian

On Fri, Jun 26, 2009 at 5:28 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Fri, Jun 26, 2009 at 04:17:56PM +0200, Adrian Cole wrote:
> > This helps, Oleg.
> >
> > However, it seems a brittle approach as it would require several custom
> > classes.
>
> Not necessarily, I would go as far as saying every more or less complex
> application should always implement custom entity classes optimized for
> that
> particular application.
>
>  It seems what is purely necessary is getting access to
> > ContentEncoder/Decoder. Are there any lifecycle hooks where I can get a
> > handle on these before they are used, or access a factory that provides
> > them?
>
> Wrapping content codecs with a custom decorator class should also work. You
> could use NHttpConnectionBase#createChunkDecoder /
> NHttpConnectionBase#createContentEncoder methods to do that. However, those
> methods were added to the 4.1 branch, so you will have to use 4.1 snapshots
> for
> the time being.
>
>
> Otherwise, its looking like AOP is the way out here...
> >
>
> For stable releases, it appears so.
>
> Oleg
>
>
> > What do you think?
> > -Adrian
> > jclouds
> >
> > On Fri, Jun 26, 2009 at 3:20 PM, Oleg Kalnichevski <ol...@apache.org>
> wrote:
> >
> > > On Fri, Jun 26, 2009 at 01:33:30PM +0200, Adrian Cole wrote:
> > > > Hello.
> > > >
> > > > I am using http core NIO and investigating how to provide feedback on
> > > upload
> > > > (PUT/POST) and download (GET) entity enclosing requests.
>  Essentially,
> > > I'd
> > > > like to know when a certain number of the overall bytes have been
> > > > transmitted/consumed.  Do you have any strategies for this for NIO?
> > > >
> > > > Thanks,
> > > > Adrian Cole
> > > > jclouds <http://code.google.com/p/jclouds>
> > >
> > > Adrian,
> > >
> > > The recommended (and the easiest) way to have a complete control over
> the
> > > data
> > > transmission process is by providing custom implementations of
> > > ConsumingNHttpEntity / ProducingNHttpEntity interfaces
> > >
> > >
> > >
> http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ConsumingNHttpEntity.html
> > >
> > >
> http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ProducingNHttpEntity.html
> > >
> > > Hope this helps
> > >
> > > Oleg
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: Status tracking

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, Jun 26, 2009 at 04:17:56PM +0200, Adrian Cole wrote:
> This helps, Oleg.
> 
> However, it seems a brittle approach as it would require several custom
> classes. 

Not necessarily, I would go as far as saying every more or less complex
application should always implement custom entity classes optimized for that
particular application.

 It seems what is purely necessary is getting access to
> ContentEncoder/Decoder. Are there any lifecycle hooks where I can get a
> handle on these before they are used, or access a factory that provides
> them?  

Wrapping content codecs with a custom decorator class should also work. You
could use NHttpConnectionBase#createChunkDecoder /
NHttpConnectionBase#createContentEncoder methods to do that. However, those
methods were added to the 4.1 branch, so you will have to use 4.1 snapshots for
the time being.


Otherwise, its looking like AOP is the way out here...
> 

For stable releases, it appears so.

Oleg


> What do you think?
> -Adrian
> jclouds
> 
> On Fri, Jun 26, 2009 at 3:20 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> 
> > On Fri, Jun 26, 2009 at 01:33:30PM +0200, Adrian Cole wrote:
> > > Hello.
> > >
> > > I am using http core NIO and investigating how to provide feedback on
> > upload
> > > (PUT/POST) and download (GET) entity enclosing requests.  Essentially,
> > I'd
> > > like to know when a certain number of the overall bytes have been
> > > transmitted/consumed.  Do you have any strategies for this for NIO?
> > >
> > > Thanks,
> > > Adrian Cole
> > > jclouds <http://code.google.com/p/jclouds>
> >
> > Adrian,
> >
> > The recommended (and the easiest) way to have a complete control over the
> > data
> > transmission process is by providing custom implementations of
> > ConsumingNHttpEntity / ProducingNHttpEntity interfaces
> >
> >
> > http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ConsumingNHttpEntity.html
> >
> > http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ProducingNHttpEntity.html
> >
> > Hope this helps
> >
> > Oleg
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >

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


Re: Status tracking

Posted by Adrian Cole <fe...@gmail.com>.
This helps, Oleg.

However, it seems a brittle approach as it would require several custom
classes.  It seems what is purely necessary is getting access to
ContentEncoder/Decoder. Are there any lifecycle hooks where I can get a
handle on these before they are used, or access a factory that provides
them?  Otherwise, its looking like AOP is the way out here...

What do you think?
-Adrian
jclouds

On Fri, Jun 26, 2009 at 3:20 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Fri, Jun 26, 2009 at 01:33:30PM +0200, Adrian Cole wrote:
> > Hello.
> >
> > I am using http core NIO and investigating how to provide feedback on
> upload
> > (PUT/POST) and download (GET) entity enclosing requests.  Essentially,
> I'd
> > like to know when a certain number of the overall bytes have been
> > transmitted/consumed.  Do you have any strategies for this for NIO?
> >
> > Thanks,
> > Adrian Cole
> > jclouds <http://code.google.com/p/jclouds>
>
> Adrian,
>
> The recommended (and the easiest) way to have a complete control over the
> data
> transmission process is by providing custom implementations of
> ConsumingNHttpEntity / ProducingNHttpEntity interfaces
>
>
> http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ConsumingNHttpEntity.html
>
> http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ProducingNHttpEntity.html
>
> Hope this helps
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: Status tracking

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, Jun 26, 2009 at 01:33:30PM +0200, Adrian Cole wrote:
> Hello.
> 
> I am using http core NIO and investigating how to provide feedback on upload
> (PUT/POST) and download (GET) entity enclosing requests.  Essentially, I'd
> like to know when a certain number of the overall bytes have been
> transmitted/consumed.  Do you have any strategies for this for NIO?
> 
> Thanks,
> Adrian Cole
> jclouds <http://code.google.com/p/jclouds>

Adrian,

The recommended (and the easiest) way to have a complete control over the data
transmission process is by providing custom implementations of
ConsumingNHttpEntity / ProducingNHttpEntity interfaces

http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ConsumingNHttpEntity.html
http://hc.apache.org/httpcomponents-core/httpcore-nio/apidocs/org/apache/http/nio/entity/ProducingNHttpEntity.html

Hope this helps

Oleg



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