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: [email protected]
For additional commands, e-mail: [email protected]