hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: question about saving the HttpEntity Content and later reproducing it
Date Tue, 28 Jul 2009 20:24:02 GMT
Brijesh Deo wrote:
> Hi Folks,
> 
>  
> 
> I have a requirement where I need to save the HttpEntity content from an
> HttpRequest object when it is a POST or PUT operation. I am reading the
> contents into a byte array and then saving it into a database table.
> Later at some point, I would read it from the database, create
> ByteArrayEntity instance from it and then create HttpPost or HttpPut
> objects and use setEntity() to set the entity into the HttpPost or
> HttpPut object. I have the following questions here:
> 
>  
> 
> 1)       Will the HttpPost or HttpPut request object know if the
> content-type is "application/x-www-form-urlencoded" or a
> "multipart/form-data" or something else just by setting the HttpEntity
> instance into it?

Depends on the HttpEntity implementation.


  Do I need to preserve the content-type beforehand
> along with the Entity content and set it explicitly here?
> 

Yes, you should.


>  
> 
> 2)       What are the http headers I need to preserve (generally with
> respect to the Entity content) from the original HttpRequest object that
> should be populated in the new HttpPost or HttpPut object so that it can
> successfully be sent to a target server using an HttpClient instance? I
> understand that headers like "Host", "Cookie" etc. might be different.
> 
>  

Only those exposed through the HttpEntity interface: content-type and 
content-encoding

Hope this helps

Oleg

> 
>  
> 
> I'm hoping someone can help me out here.
> 
>  
> 
> Thanks,
> 
> Brijesh
> 
> 


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


Mime
View raw message