On Wed, 2008-06-04 at 07:07 +0200, pluenl wrote:
> I've implemented a proxy application (using HttpClient 3.1) with some 
> manipulation logic. 
>  
> Now I want to implement a cache for some requests/responses. 
>  
> I've had a look in the API (and the mailing list) but could not find out how 
> to 
> use HttpCore to create a Response-object, write it to the file system and 
> recreate the response for a later (cached) request from the file system. 

Martin, 

What is it exactly intend to cache? HTTP content body, content +
headers, raw data stream?

>  
> What are the key classes to construct a Response without a socket from 
> scratch 
> respectivly from file and how can I write the response (as serialized on a 
> socket stream) to a file parsing it again? 

The response head only:

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/HttpResponseParser.java

In order to generate a complete response object with a content entity
you will have to extend this class:

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.html

You will also need to create mock input / output session buffers,
something similar to those:

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/SessionInputBufferMockup.java
http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/SessionOutputBufferMockup.java

Hope this helps

Oleg


>  
> Thanks in advance, 
> Martin 
> 




> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to