On Wed, 13 Jun 2001, Fabian Loschek wrote:
> Hello,
>
> > I would like Tomcat to serve requests for a new Internet Draft Protocol
> > named ICAP. The intension is to develop HTTP like ICAP servlet base classes
> > to allow writing ICAP applications.
> >
Is there an RFC number or other URL reference for this?
> > Can someone give me pointers/references of where can I start ??
>
> I'm looking for something similar for writing an ICAP Servlet for my
> master thesis, have you gotten hold of any references or code snipplets?
>
> Thanks in advance,
> Fabian.
>
Not being familiar with ICAP, I'm assuming that it's "similar to but
different than" HTTP, so that you can't just use a normal HttpServlet to
talk to it. If this isn't correct, just ignore the following ramblings
:-). The general way to extend Catalina (the servlet container inside
Tomcat 4.0) for this would include the following steps:
* Create new IcapRequest and IcapResponse classes that extend
org.apache.catalina.connector.RequestBase and
org.apache.catalina.connector.ResponseBase respectively.
* Create an IcapServlet that extends Servlet (or HttpServlet)
based on your needs.
* Write a new Connector implementation that implements the ICAP
communications protocol as necessary. The basic idea is that
you would instantiate an IcapRequest and an IcapResponse, populate
the request appropriately, and then pass it on to the
associated Engine in the same way that the HTTP connector does.
* At the Engine level, you may need to implement a custom Mapper
that would be used to select which Host object to use. You can
have multiple Mappers per Container (one per protocol), so you
can still be processing HTTP requests through the same Engine.
* Likewise, at the Host level, you may need a custom Mapper to select
the appropriate web application (if you want to support this
concept).
* Finally, at the Context level, you may need a custom Mapper to
select the appropriate servlet to be executed.
Depending upon how similar ICAP and HTTP are, you might be able to
leverage a lot of the existing machinery (most of the internal APIs, for
example, pass Request and Response rather than HttpRequest and
HttpResponse). But the exact level of code reuse is really dependent on
the nature of the protocol you're trying to support.
Craig McClanahan