On Tue, 2006-08-29 at 20:22 +0000, Doug Lochart wrote: > I decided to wrap the input stream that would do on the fly filtering. > However you really need the entire content in memory to do proper regular > expressions and content filtering so > I only want to read the entire entity at once if I am going to do filtering. > > Anyway I thought I knew where I could put the code but it was never > executing. It turns out (after looking further into the source) that the > entity is not really created until the > doDeserialize() method is called (that is correct right?) > > In doService() I went out to the server and git the response. I then > extracted the entity from that response, wrapped it with another entity that > will wrap the input stream and then > set that entity into the response going back to the original client. > > I then look and it seems that after the call to doService() and > postprocessResponse() a call to deserialize occurs and within there a new > Entity is created and populated. > > I am still learning the overall design and I don't have it all quite yet (as > is obvious) > > My question to you is: Is creating my own DefaultEntityDeserializer the > correct approach based on the way the code is designed or are there other > intercept points, wrap points that > I can use that I have not yet uncovered? >
Hi Doug, The best approach is apply some sort of a transformation to all HTTP requests or responses is to develop a custom protocol interceptor. Protocol interceptors are very similar to Servlet filters. Take a look at these sample classes that implement transparent content compression / decompression as a reference material: http://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/trunk/src/contrib/org/apache/http/contrib/compress/ For example, the ResponseGzipCompress.java interceptor wraps the original response with GzipCompressingEntity.java, which compresses response content on-fly. Its counterpart, the ResponseGzipUncompress.java interceptors applies the reverse transformation by wrapping the response entity with GzipDecompressingEntity.java. In order to implement transparent content compression / decompression one simply should add the ResponseGzipCompress.java interceptor to the server side HTTP service and the ResponseGzipUncompress.java and RequestAcceptEncoding.java interceptors to the client side HTTP executor without having to change a single line of application code. Hope this helps Oleg > thanks > > Doug > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
