On Tue, 2011-03-22 at 09:53 +0000, Sam Crawford wrote:
> Morning,
> 
> I'm interested in developing an ICAP server for the purposes of
> content filtering and rewriting. As per the RFC
> (http://www.faqs.org/rfcs/rfc3507.html), ICAP uses an almost identical
> request/response protocol to HTTP. The only discernible difference I
> can see is it's use of different verbs (which HttpCore will take care
> of already), a different URI scheme and a different protocol name
> (ICAP/1.0 is the current one). For example, a typical request line
> might be:
> 
> RESPMOD icap://icap.example.net/translate?mode=french ICAP/1.0
> 
> I've built a number of servers successfully with HttpCore NIO and am
> very comfortable with its operation and performance. I'm wondering if
> it's possible to re-use HttpCore for this project, even though it's
> not HTTP.
> 
> So, a couple of questions:
> 
> 1) Is this a sensible thing to do?

Seems so as long as ICAP employs the same mechanisms to delimit entity
content as HTTP (content-length or chunk coding)

> 2) Is there an easy way to instruct HttpCore to accept ICAP messages

Easy? Probably not ;-) It is certainly doable, though. You would need a
number of custom classes such ICAP specific message parser and formatter

> (like the request line above) and produce ICAP responses? Moreover, is
> there a class I can extend to specify support for different protocols,
> or does HttpCore not expose this?
> 

Have a look at the 

DefaultHttpRequestParser / DefaultHttpResponseWriter classes in the
HttpCore NIO module. You would need similar classes that are ICAP
protocol aware. 

Most probably you will need a custom HTTP connection implementation that
employs ICAP specific message parser / formatter when serializing /
deserializing messages. Otherwise you should be able to re-use existing
HTTP protocol code.

There is also an example of client side SIP protocol implementation
based on HttpCore (blocking) in the contrib package you might want to
take a look at: 

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/httpcore-contrib/src/main/java/org/apache/http/contrib/sip/

Hope this helps

Cheers

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to