On Wed, 13 Jun 2001, D. Jay Newman wrote:

> > 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.
> 
> I have a similar problem. I would like to use *generic* servlets rather
> than HttpServlet's.
> 
> Is there a "base connector" that only relies on a port and not a protocol?

There is a Connector interface (no base class), but it won't do you a lot
of good.  The problem is that there is a huge amount of variability in how
protocols work.  You can think of a Connector as an adapter (in the design
patterns sense) between some "on the wire" protocol and the Request and
Response abstractions that are used in the rest of Catalina.  
Technically, even "on the wire" isn't quite accurate -- it's perfectly
feasible to write a Connector that accepts requests via JNI calls rather
than sockets, which would be useful when you embed Catalina inside a web
server.

I'd start writing a new Connector by examining the existing HTTP one (see
package org.apache.catalina.connector.http), and then modelling your own
based on that.  For a typical request/response protocol based on sockets,
you can probably keep most of the "HttpConnector" architecture and do your
customizations in your version of "HttpProcessor".  Alternatively, you
might look at how other open source servlet containers do this sort of
thing -- for instance, Tomcat 3.x uses thread pools to implement
multi-threading in a somewhat different manner.

The good news with Catalina is that the interface to the rest of the
container is pretty thin -- just call engine.invoke() and pass your
request and response implementation objects.  Other details (like the
mappings) can be made with additional components in the Container
hierarchy as necessary, depending on how similar or dissimilar your new
protocol is to the existing assumptions.

> -- 
> D. Jay Newman                   ! For the pleasure and the profit it derives
> [EMAIL PROTECTED]              ! I arrange things, like furniture, and
> http://www.sprucegrove.com/~jay/   ! daffodils, and ...lives.  -- Hello Dolly
> 

Craig McClanahan


Reply via email to