You are viewing a plain text version of this content. The canonical link for it is here.
Posted to droids-dev@incubator.apache.org by Javier Puerto <jp...@gmail.com> on 2009/09/08 07:59:12 UTC

Raw content on HttpContentEntity

Hi,

Working with a crawler I need to post the response (xml) to an Apache Solr
and found problems to do it because the class HttpContentEntity don't give
me enougth freedom.

Creating a HttpEntity to post by a Handler . I tried three forms:

 * final ByteArrayEntity entityHttp = new
ByteArrayEntity(IOUtils.toByteArray(entity.getContents())); //Have to read
all the bytes and store in a byte array.

 * final InputStreamEntity entityHttp = new
InputStreamEntity(entity.getContents(), LENGTH); //I like this form, but I
don't have the content length.

 * Modify the HttpContentEntity class so i could get the raw entity. //This
is the more comfortable and flexible manner.

  public HttpEntity getRawEntity() {
    return this.entity;
  }


What do you think? Does it make sense to change the HttpContentEntity class
and add the above method?

Or are there are some reasons to not expose the HttpEntity like that?

If not I will prepare a patch.

Salu2.

Re: Raw content on HttpContentEntity

Posted by Thorsten Scherler <th...@apache.org>.
On Wed, 2009-09-09 at 10:11 +0200, Oleg Kalnichevski wrote:
> On Tue, Sep 08, 2009 at 10:25:24PM +0200, Thorsten Scherler wrote:
...
> > > Or are there are some reasons to not expose the HttpEntity like that?
> > 
> > Oleg, wdyt?
> > 
> 
> I personally do not see a problem with that.

Thank you very much for taking the time, I know you are very busy. 

So Javier please go ahead and prepare a patch.

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source <consulting, training and solutions>


Re: Raw content on HttpContentEntity

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, Sep 08, 2009 at 10:25:24PM +0200, Thorsten Scherler wrote:
> On Tue, 2009-09-08 at 09:59 +0200, Javier Puerto wrote:
> > Hi,
> 
> Hi Javier,
> 
> I included Oleg in cc since he knows about your final question.
> 
> > Working with a crawler I need to post the response (xml) to an Apache Solr
> > and found problems to do it because the class HttpContentEntity don't give
> > me enougth freedom.
> > 
> > Creating a HttpEntity to post by a Handler . I tried three forms:
> > 
> >  * final ByteArrayEntity entityHttp = new
> > ByteArrayEntity(IOUtils.toByteArray(entity.getContents())); //Have to read
> > all the bytes and store in a byte array.
> > 
> >  * final InputStreamEntity entityHttp = new
> > InputStreamEntity(entity.getContents(), LENGTH); //I like this form, but I
> > don't have the content length.
> > 
> >  * Modify the HttpContentEntity class so i could get the raw entity. //This
> > is the more comfortable and flexible manner.
> > 
> >   public HttpEntity getRawEntity() {
> >     return this.entity;
> >   }
> > 
> > 
> > What do you think? Does it make sense to change the HttpContentEntity class
> > and add the above method?
> > 
> 
> I see your point and if there is no good reason to not expose the entity
> I say go ahead and create a patch.
> 
> > Or are there are some reasons to not expose the HttpEntity like that?
> 
> Oleg, wdyt?
> 

I personally do not see a problem with that.

Oleg


> salu2
> 
> > If not I will prepare a patch.
> > 
> > Salu2.
> -- 
> ???Thorsten Scherler <thorsten.at.apache.org>
> Open Source <consulting, training and solutions>
> 

Re: Raw content on HttpContentEntity

Posted by Thorsten Scherler <th...@apache.org>.
On Tue, 2009-09-08 at 09:59 +0200, Javier Puerto wrote:
> Hi,

Hi Javier,

I included Oleg in cc since he knows about your final question.

> Working with a crawler I need to post the response (xml) to an Apache Solr
> and found problems to do it because the class HttpContentEntity don't give
> me enougth freedom.
> 
> Creating a HttpEntity to post by a Handler . I tried three forms:
> 
>  * final ByteArrayEntity entityHttp = new
> ByteArrayEntity(IOUtils.toByteArray(entity.getContents())); //Have to read
> all the bytes and store in a byte array.
> 
>  * final InputStreamEntity entityHttp = new
> InputStreamEntity(entity.getContents(), LENGTH); //I like this form, but I
> don't have the content length.
> 
>  * Modify the HttpContentEntity class so i could get the raw entity. //This
> is the more comfortable and flexible manner.
> 
>   public HttpEntity getRawEntity() {
>     return this.entity;
>   }
> 
> 
> What do you think? Does it make sense to change the HttpContentEntity class
> and add the above method?
> 

I see your point and if there is no good reason to not expose the entity
I say go ahead and create a patch.

> Or are there are some reasons to not expose the HttpEntity like that?

Oleg, wdyt?

salu2

> If not I will prepare a patch.
> 
> Salu2.
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source <consulting, training and solutions>