Discussion:
Tomcat Custom Connector
Simon Aquilina
2008-06-03 10:03:15 UTC
Permalink
Hi,
I am interested in building a custom connector for Tomcat. I have checked the Tomcat source code and found the source code for the ‘http11’ and ‘ajp’ connectors. I thought of trying to understand the code of these two connectors and then try to implement mine based on these. However I am no expert and was wondering if there is any good documentation/tutorial on how a connector can be developed for Tomcat (I would later use this connector with Geronimo).
Just to give you some insight; what I want to achieve is to build a custom connector so that Tomcat can understand requests made from a 3rd party clients who cannot communicate using the Http protocol and nor do they expect data in html format. Additionally some of the clients could communicate on Bluetooth!
I do not know if the above is even possible but I am willing to try :)
Thanks for any replies,
Regards,Sim085
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
Bill Barker
2008-06-04 02:17:03 UTC
Permalink
AFAIK, there isn't a lot of documentation. But there isn't that much too
it. You need to implement a ProtocolHandler
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html)
This class is responsible for managing the transport (e.g. ServerSocket) and
request threads (but the various EndPoint classes in
org.apache.tomcat.util.net may simplify this aspect for you). For best
results, this class may implement ActionHook as well
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).

When a new request comes in, it is the ProtocolHandler's job to initialize a
Request
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html)
and a Response
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html)
objects for it, making certain that they get valid InputBuffer
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html)
and OutputBuffer
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html)
instances to comunicate with the client. Then within the thread, you hand
the Request and Response off to the service method of the Adapter
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html)
that Tomcat will give to the ProtocolHandler. And that is pretty much it
:).

Using the standard server.xml (as opposed to Embedding), you would configure
Tomcat to use your Connector with an element like:
<Connector protocol="com.myfirm.mypackage.MyProtocolHandler" ... />
Any other attributes in the <Connector /> tag will be passed JavaBean style
to the ProtocolHandler to handle init options.

For the simplest example, look at
org.apache.coyote.memory.MemoryProtocolHandler (but this one is mostly
useful for unit testing).

"Simon Aquilina" <***@hotmail.com> wrote in message news:BAY118-***@phx.gbl...

Hi,
I am interested in building a custom connector for Tomcat. I have checked
the Tomcat source code and found the source code for the ‘http11’ and ‘ajp’
connectors. I thought of trying to understand the code of these two
connectors and then try to implement mine based on these. However I am no
expert and was wondering if there is any good documentation/tutorial on how
a connector can be developed for Tomcat (I would later use this connector
with Geronimo).
Just to give you some insight; what I want to achieve is to build a custom
connector so that Tomcat can understand requests made from a 3rd party
clients who cannot communicate using the Http protocol and nor do they
expect data in html format. Additionally some of the clients could
communicate on Bluetooth!
I do not know if the above is even possible but I am willing to try :)
Thanks for any replies,
Regards,Sim085
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx




---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Simon Aquilina
2008-06-04 07:59:15 UTC
Permalink
Hi Bill,
Thank you very much for your comments – they are really helpful since as you said there is little-to-no documentation on the web on how to develop a custom connector.
Thanks again for your help :)
Best Regards,Sim085
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
Simon Aquilina
2008-06-11 08:05:17 UTC
Permalink
Hi,

I have checked the code but still find it a little bit hard to come with something all by myself. I was wondering (although I am afraid I already know the answer) is there any book that explains how tomcat (6.0) internally works and explains how connectors can be developed for it? I tried searching on Amazon but so far I did not have much luck.

Regards,
Sim085> To: ***@tomcat.apache.org> From: ***@wilshire.com> Subject: Re: Tomcat Custom Connector> Date: Tue, 3 Jun 2008 19:17:03 -0700> > AFAIK, there isn't a lot of documentation. But there isn't that much too > it. You need to implement a ProtocolHandler > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html) > This class is responsible for managing the transport (e.g. ServerSocket) and > request threads (but the various EndPoint classes in > org.apache.tomcat.util.net may simplify this aspect for you). For best > results, this class may implement ActionHook as well > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).> > When a new request comes in, it is the ProtocolHandler's job to initialize a > Request > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html) > and a Response > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html) > objects for it, making certain that they get valid InputBuffer > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html) > and OutputBuffer > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html) > instances to comunicate with the client. Then within the thread, you hand > the Request and Response off to the service method of the Adapter > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html) > that Tomcat will give to the ProtocolHandler. And that is pretty much it > :).> > Using the standard server.xml (as opposed to Embedding), you would configure > Tomcat to use your Connector with an element like:> <Connector protocol="com.myfirm.mypackage.MyProtocolHandler" ... />> Any other attributes in the <Connector /> tag will be passed JavaBean style > to the ProtocolHandler to handle init options.> > For the simplest example, look at > org.apache.coyote.memory.MemoryProtocolHandler (but this one is mostly > useful for unit testing).> > "Simon Aquilina" <***@hotmail.com> wrote in message > news:BAY118-***@phx.gbl...> > Hi,> I am interested in building a custom connector for Tomcat. I have checked > the Tomcat source code and found the source code for the ‘http11’ and ‘ajp’ > connectors. I thought of trying to understand the code of these two > connectors and then try to implement mine based on these. However I am no > expert and was wondering if there is any good documentation/tutorial on how > a connector can be developed for Tomcat (I would later use this connector > with Geronimo).> Just to give you some insight; what I want to achieve is to build a custom > connector so that Tomcat can understand requests made from a 3rd party > clients who cannot communicate using the Http protocol and nor do they > expect data in html format. Additionally some of the clients could > communicate on Bluetooth!> I do not know if the above is even possible but I am willing to try :)> Thanks for any replies,> Regards,Sim085> _________________________________________________________________> News, entertainment and everything you care about at Live.com. Get it now!> http://www.live.com/getstarted.aspx > > > > > ---------------------------------------------------------------------> To start a new topic, e-mail: ***@tomcat.apache.org> To unsubscribe, e-mail: users-***@tomcat.apache.org> For additional commands, e-mail: users-***@tomcat.apache.org>
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
Simon Aquilina
2008-06-12 15:13:03 UTC
Permalink
Hi,

I have checked the code in Tomcat again, and although it is very confusing I feel I did understand something here and there :)

However I have a question - where is the adapter being set? No Adapter is being initialized in the 'JIoEndPoint', 'Http11Protocol' and 'Http11Processor'. I also checked the 'server.xml' file and this is not being set! From the API documentation I found out the 'CoyoteAdapter'; so is this the default being used for Tomcat? Is it the CoyoteAdapter which is responsible to find the servlet for which the request is? or?

Thanks for any comments,
Simon J.
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
Bill Barker
2008-06-14 02:51:35 UTC
Permalink
The Adapter is set in the initialize method of the Connector
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/Connector.html).
You can pretty much just trust that Tomcat will give you an Adapter instance
before the first request comes through, since that is the contract. Yes,
the current implementation only will give you an instance of CoyoteAdapter,
but programming your ProtocolHandler around this is dangerous, since the
contract only promises an instance of Adapter.

The Adapter is the bridge between your ProtocolHandler and the Tomcat
Servlet Container. Once you hand off your Request and Response objects to
the Adapter, you can trust that Tomcat will handle all of the Servlet-Spec
parts by itself, including finding the Servlet to send the request to. At
that point, you are only responsible for communicating with the client over
the wire via the InputBuffer and OutputBuffer interfaces. For example, the
various AJP/1.3 Connectors
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html)
convert the message into AJP/1.3 format before sending it over the wire to
Apache httpd.

Once you have figured out how to initialize the Request and Response objects
to look enough like the wire protocol was HTTP, the rest is really pretty
easy :). For non-HTTP protocols (e.g. trying to make Tomcat look like an
FTP server), this is the hard part.

"Simon Aquilina" <***@hotmail.com> wrote in message news:BAY118-***@phx.gbl...

Hi,

I have checked the code in Tomcat again, and although it is very confusing I
feel I did understand something here and there :)

However I have a question - where is the adapter being set? No Adapter is
being initialized in the 'JIoEndPoint', 'Http11Protocol' and
'Http11Processor'. I also checked the 'server.xml' file and this is not
being set! From the API documentation I found out the 'CoyoteAdapter'; so is
this the default being used for Tomcat? Is it the CoyoteAdapter which is
responsible to find the servlet for which the request is? or?

Thanks for any comments,
Simon J.
Post by Simon Aquilina
Tomcat Custom Connector> Date: Tue, 3 Jun 2008 19:17:03 -0700> > AFAIK,
there isn't a lot of documentation. But there isn't that much too > it.
You need to implement a ProtocolHandler >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html)
Post by Bill Barker
This class is responsible for managing the transport (e.g. ServerSocket)
and > request threads (but the various EndPoint classes in >
org.apache.tomcat.util.net may simplify this aspect for you). For best >
results, this class may implement ActionHook as well >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).>
Post by Bill Barker
When a new request comes in, it is the ProtocolHandler's job to
initialize a > Request >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html)
Post by Bill Barker
and a Response >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html)
Post by Bill Barker
objects for it, making certain that they get valid InputBuffer >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html)
Post by Bill Barker
and OutputBuffer >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html)
Post by Bill Barker
instances to comunicate with the client. Then within the thread, you
hand > the Request and Response off to the service method of the Adapter >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html)
Post by Bill Barker
that Tomcat will give to the ProtocolHandler. And that is pretty much it
:).> > Using the standard server.xml (as opposed to Embedding), you
would configure > Tomcat to use your Connector with an element like:>
<Connector protocol="com.myfirm.mypackage.MyProtocolHandler" ... />> Any
other attributes in the <Connector /> tag will be passed JavaBean style >
to the ProtocolHandler to handle init options.> > For the simplest
example, look at > org.apache.coyote.memory.MemoryProtocolHandler (but
this one is mostly > useful for unit testing).> > "Simon Aquilina"
interested in building a custom connector for Tomcat. I have checked > the
Tomcat source code and found the source code for the ‘http11’ and ‘ajp’ >
connectors. I thought of trying to understand the code of these two >
connectors and then try to implement mine based on these. However I am no
Post by Bill Barker
expert and was wondering if there is any good documentation/tutorial on
how > a connector can be developed for Tomcat (I would later use this
connector > with Geronimo).> Just to give you some insight; what I want to
achieve is to build a custom > connector so that Tomcat can understand
requests made from a 3rd party > clients who cannot communicate using the
Http protocol and nor do they > expect data in html format. Additionally
some of the clients could > communicate on Bluetooth!> I do not know if
the above is even possible but I am willing to try :)> Thanks for any
replies,> Regards,Sim085>
_________________________________________________________________> News,
entertainment and everything you care about at Live.com. Get it now!>
http://www.live.com/getstarted.aspx > > > >
Post by Bill Barker
--------------------------------------------------------------------->
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx




---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Martin Gainty
2008-06-15 01:04:56 UTC
Permalink
Any ability to configure in custom JioEndpoint?
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/tomcat/util/net/JIoEndpoint.html

which can be configured as parameter to Ajp?
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html#AjpProcessor(int,%20org.apache.tomcat.util.net.JIoEndpoint)

?
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
Post by Simon Aquilina
Subject: Re: Tomcat Custom Connector
Date: Fri, 13 Jun 2008 19:51:35 -0700
The Adapter is set in the initialize method of the Connector
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/Connector.html).
You can pretty much just trust that Tomcat will give you an Adapter instance
before the first request comes through, since that is the contract. Yes,
the current implementation only will give you an instance of CoyoteAdapter,
but programming your ProtocolHandler around this is dangerous, since the
contract only promises an instance of Adapter.
The Adapter is the bridge between your ProtocolHandler and the Tomcat
Servlet Container. Once you hand off your Request and Response objects to
the Adapter, you can trust that Tomcat will handle all of the Servlet-Spec
parts by itself, including finding the Servlet to send the request to. At
that point, you are only responsible for communicating with the client over
the wire via the InputBuffer and OutputBuffer interfaces. For example, the
various AJP/1.3 Connectors
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html)
convert the message into AJP/1.3 format before sending it over the wire to
Apache httpd.
Once you have figured out how to initialize the Request and Response objects
to look enough like the wire protocol was HTTP, the rest is really pretty
easy :). For non-HTTP protocols (e.g. trying to make Tomcat look like an
FTP server), this is the hard part.
Hi,
I have checked the code in Tomcat again, and although it is very confusing I
feel I did understand something here and there :)
However I have a question - where is the adapter being set? No Adapter is
being initialized in the 'JIoEndPoint', 'Http11Protocol' and
'Http11Processor'. I also checked the 'server.xml' file and this is not
being set! From the API documentation I found out the 'CoyoteAdapter'; so is
this the default being used for Tomcat? Is it the CoyoteAdapter which is
responsible to find the servlet for which the request is? or?
Thanks for any comments,
Simon J.
Post by Simon Aquilina
Tomcat Custom Connector> Date: Tue, 3 Jun 2008 19:17:03 -0700> > AFAIK,
there isn't a lot of documentation. But there isn't that much too > it.
You need to implement a ProtocolHandler >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html)
Post by Bill Barker
This class is responsible for managing the transport (e.g. ServerSocket)
and > request threads (but the various EndPoint classes in >
org.apache.tomcat.util.net may simplify this aspect for you). For best >
results, this class may implement ActionHook as well >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).>
Post by Bill Barker
When a new request comes in, it is the ProtocolHandler's job to
initialize a > Request >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html)
Post by Bill Barker
and a Response >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html)
Post by Bill Barker
objects for it, making certain that they get valid InputBuffer >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html)
Post by Bill Barker
and OutputBuffer >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html)
Post by Bill Barker
instances to comunicate with the client. Then within the thread, you
hand > the Request and Response off to the service method of the Adapter >
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html)
Post by Bill Barker
that Tomcat will give to the ProtocolHandler. And that is pretty much it
:).> > Using the standard server.xml (as opposed to Embedding), you
would configure > Tomcat to use your Connector with an element like:>
<Connector protocol="com.myfirm.mypackage.MyProtocolHandler" ... />> Any
other attributes in the <Connector /> tag will be passed JavaBean style >
to the ProtocolHandler to handle init options.> > For the simplest
example, look at > org.apache.coyote.memory.MemoryProtocolHandler (but
this one is mostly > useful for unit testing).> > "Simon Aquilina"
interested in building a custom connector for Tomcat. I have checked > the
Tomcat source code and found the source code for the ‘http11’ and ‘ajp’ >
connectors. I thought of trying to understand the code of these two >
connectors and then try to implement mine based on these. However I am no
Post by Bill Barker
expert and was wondering if there is any good documentation/tutorial on
how > a connector can be developed for Tomcat (I would later use this
connector > with Geronimo).> Just to give you some insight; what I want to
achieve is to build a custom > connector so that Tomcat can understand
requests made from a 3rd party > clients who cannot communicate using the
Http protocol and nor do they > expect data in html format. Additionally
some of the clients could > communicate on Bluetooth!> I do not know if
the above is even possible but I am willing to try :)> Thanks for any
replies,> Regards,Sim085>
_________________________________________________________________> News,
entertainment and everything you care about at Live.com. Get it now!>
http://www.live.com/getstarted.aspx > > > >
Post by Bill Barker
--------------------------------------------------------------------->
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
---------------------------------------------------------------------
_________________________________________________________________
Search that pays you back! Introducing Live Search cashback.
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=srchpaysyouback
Simon Aquilina
2008-06-17 08:41:54 UTC
Permalink
Hi Bill,

Thanks again for your reply. Your comments are very helpfull :) I will definitly have other questions in the future but for now I think I can move forward :)

Thanks again,
Simon J.> To: ***@tomcat.apache.org> From: ***@wilshire.com> Subject: Re: Tomcat Custom Connector> Date: Fri, 13 Jun 2008 19:51:35 -0700> > The Adapter is set in the initialize method of the Connector > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/Connector.html). > You can pretty much just trust that Tomcat will give you an Adapter instance > before the first request comes through, since that is the contract. Yes, > the current implementation only will give you an instance of CoyoteAdapter, > but programming your ProtocolHandler around this is dangerous, since the > contract only promises an instance of Adapter.> > The Adapter is the bridge between your ProtocolHandler and the Tomcat > Servlet Container. Once you hand off your Request and Response objects to > the Adapter, you can trust that Tomcat will handle all of the Servlet-Spec > parts by itself, including finding the Servlet to send the request to. At > that point, you are only responsible for communicating with the client over > the wire via the InputBuffer and OutputBuffer interfaces. For example, the > various AJP/1.3 Connectors > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html) > convert the message into AJP/1.3 format before sending it over the wire to > Apache httpd.> > Once you have figured out how to initialize the Request and Response objects > to look enough like the wire protocol was HTTP, the rest is really pretty > easy :). For non-HTTP protocols (e.g. trying to make Tomcat look like an > FTP server), this is the hard part.> > "Simon Aquilina" <***@hotmail.com> wrote in message > news:BAY118-***@phx.gbl...> > Hi,> > I have checked the code in Tomcat again, and although it is very confusing I > feel I did understand something here and there :)> > However I have a question - where is the adapter being set? No Adapter is > being initialized in the 'JIoEndPoint', 'Http11Protocol' and > 'Http11Processor'. I also checked the 'server.xml' file and this is not > being set! From the API documentation I found out the 'CoyoteAdapter'; so is > this the default being used for Tomcat? Is it the CoyoteAdapter which is > responsible to find the servlet for which the request is? or?> > Thanks for any comments,> Simon J.> > To: ***@tomcat.apache.org> From: ***@wilshire.com> Subject: Re: > > Tomcat Custom Connector> Date: Tue, 3 Jun 2008 19:17:03 -0700> > AFAIK, > > there isn't a lot of documentation. But there isn't that much too > it. > > You need to implement a ProtocolHandler > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html) > > > This class is responsible for managing the transport (e.g. ServerSocket) > > and > request threads (but the various EndPoint classes in > > > org.apache.tomcat.util.net may simplify this aspect for you). For best > > > results, this class may implement ActionHook as well > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).> > > > When a new request comes in, it is the ProtocolHandler's job to > > initialize a > Request > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html) > > > and a Response > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html) > > > objects for it, making certain that they get valid InputBuffer > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html) > > > and OutputBuffer > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html) > > > instances to comunicate with the client. Then within the thread, you > > hand > the Request and Response off to the service method of the Adapter > > > (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html) > > > that Tomcat will give to the ProtocolHandler. And that is pretty much it > > > :).> > Using the standard server.xml (as opposed to Embedding), you > > would configure > Tomcat to use your Connector with an element like:> > > <Connector protocol="com.myfirm.mypackage.MyProtocolHandler" ... />> Any > > other attributes in the <Connector /> tag will be passed JavaBean style > > > to the ProtocolHandler to handle init options.> > For the simplest > > example, look at > org.apache.coyote.memory.MemoryProtocolHandler (but > > this one is mostly > useful for unit testing).> > "Simon Aquilina" > > <***@hotmail.com> wrote in message > > > news:BAY118-***@phx.gbl...> > Hi,> I am > > interested in building a custom connector for Tomcat. I have checked > the > > Tomcat source code and found the source code for the ‘http11’ and ‘ajp’ > > > connectors. I thought of trying to understand the code of these two > > > connectors and then try to implement mine based on these. However I am no > > > expert and was wondering if there is any good documentation/tutorial on > > how > a connector can be developed for Tomcat (I would later use this > > connector > with Geronimo).> Just to give you some insight; what I want to > > achieve is to build a custom > connector so that Tomcat can understand > > requests made from a 3rd party > clients who cannot communicate using the > > Http protocol and nor do they > expect data in html format. Additionally > > some of the clients could > communicate on Bluetooth!> I do not know if > > the above is even possible but I am willing to try :)> Thanks for any > > replies,> Regards,Sim085> > > _________________________________________________________________> News, > > entertainment and everything you care about at Live.com. Get it now!> > > http://www.live.com/getstarted.aspx > > > > > > > ---------------------------------------------------------------------> > > To start a new topic, e-mail: ***@tomcat.apache.org> To unsubscribe, > > e-mail: users-***@tomcat.apache.org> For additional commands, > > e-mail: users-***@tomcat.apache.org>> _________________________________________________________________> News, entertainment and everything you care about at Live.com. Get it now!> http://www.live.com/getstarted.aspx > > > > > ---------------------------------------------------------------------> To start a new topic, e-mail: ***@tomcat.apache.org> To unsubscribe, e-mail: users-***@tomcat.apache.org> For additional commands, e-mail: users-***@tomcat.apache.org>
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
Simon Aquilina
2008-09-20 18:11:31 UTC
Permalink
Hi again,

(I posted a similar question to this in the dev mailing list because I misunderstood the aim of that mailing list).

During these last few weeks I did a lot of research on how connectors work in Tomcat and I can understand most of it now. However I have a small issue.

I noticed that the Request class in the Coyote package does not inherit from the ServletRequest interface. This made me wonder if internally tomcat actually maps the type of Request object to another type of Request object of type ServletRequest (at first).

I therefore decided to check the code of the CoyoteAdapter inside the Catalina package. Here I found that in the service() method first a Request object of type HttpServlet is tried to retrieved from the Request object created in the Coyote package. If this is not found then it is created.

Therefor I feel that in order to develop a protocol handler completly http independent then I will need to also develop my own implementation of Adapter! Is this right? If so how would I tell tomcat to use my Adapter version?

Also howcome this type of design. I am sure that there must be a reason behind it. However why isn't the Request object created of type HttpServlet or some other type within the Coyote package rather then leave it to the CoyoteAdapter within the Catalina package.

Thanks and Regards,
Simon J.
Subject: RE: Tomcat Custom Connector
Date: Tue, 17 Jun 2008 10:41:54 +0200
Hi Bill,
Thanks again for your reply. Your comments are very helpfull :) I will definitly have other questions in the future but for now I think I can move forward :)
Thanks again,
_________________________________________________________________
Connect to the next generation of MSN Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
Loading...