You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Simon Aquilina <si...@hotmail.com> on 2008/09/19 14:13:31 UTC

Question about org.apache.coyote.Request

Hi,

I am new in the Tomcat world. However these last few months I tried to understand a little better how tomcat works concentrating mostly on the Connectors (Protocol Handlers) aspect. I now found something which is confusing me a little and I hope someone here can explain to me how this works out.

When I downloaded the source code and opened org.apache.coyote.Request I found out that this does not inherit from javax.servlet.ServletRequest, nor to any other class. This is confusing me!

When a request and response objects are constructed, the processor will call the Adapter.process() method which takes the request (org.apache.coyote.Request) and response (org.apache.coyote.Response) objects as parameters. At the end of the line a servlet service() method is called. However how is this possible if the service() method of the servlet object can only recieve a request and response objects of type ServletRequest and ServletResponse respectivly!? 

Does tomcat internally have some mapping functionality to change a Request/Response object of type org.apache.coyote.Request/Response to type javax.servlet.ServletRequest/ServletResponse?

Sorry if the question may sound stupid. I am not what you call an expert programmer but have spent lots of time to understand how Tomcat works. My final aim is to actually develop my own connector (as I said on the users list).

btw - I posted this on this mailing list since I am actually extending Tomcat funtionality then just using it. So I tought this was a better place to ask this.

Thanks & Regards,
Simon J.

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

RE: Question about org.apache.coyote.Request

Posted by Simon Aquilina <si...@hotmail.com>.
Hi,

I think I am posting in the wrong mailing list. I posted my question here because I felt it was "Apache Tomcat source code" related. However I feel that this mailing list is only for the developers who actually change the Apache Tomcat source code for the next release. I am sorry for any the inconvenience.

Regards,
Simon J.  


From: sim085@hotmail.com
To: dev@tomcat.apache.org
Subject: RE: Question about org.apache.coyote.Request
Date: Sat, 20 Sep 2008 19:41:04 +0200







Hi again,

I continued doing further research on Tomcat and I feel as if Tomcat is not able to support custom developed Protocol Handlers without changing also some code in the Catalina package as well!

I opened the CoyoteAdapter in the Catalina package and here it seems that the service() method takes it for granted that any in coming request is of type Http (since the Request object used in this class extends HttpRequest). This means that if I want to develop a connector for Tomcat completly http independent then I will also have to develop my own CoyoteAdapter and somehow tell Tomcat to use this one! Right? (I accept the fact that i could possible be talking rubish. If so please do tell me - at least I would learn something).

I also cannot understand another thing. If in theory the Http11Protocol class is responsable to handle any http request, then why doesn't this create a Request object of type HttpRequest at that level; rather then let the CoyoteAdapter in the Catalina package do that? (At the moment it seems that the Http11Protocol will create a Request object (which is very similar to the actual HttpRequest) which is then send to the Adapter, which in turn creates an HttpRequest).

Thanks & Regards,
Simon J.





> From: sim085@hotmail.com
> To: dev@tomcat.apache.org
> Subject: Question about org.apache.coyote.Request 
> Date: Fri, 19 Sep 2008 14:13:31 +0200
> 
> Hi,
> 
> I am new in the Tomcat world. However these last few months I tried to understand a little better how tomcat works concentrating mostly on the Connectors (Protocol Handlers) aspect. I now found something which is confusing me a little and I hope someone here can explain to me how this works out.
> 
> When I downloaded the source code and opened org.apache.coyote.Request I found out that this does not inherit from javax.servlet.ServletRequest, nor to any other class. This is confusing me!
> 
> When a request and response objects are constructed, the processor will call the Adapter.process() method which takes the request (org.apache.coyote.Request) and response (org.apache.coyote.Response) objects as parameters. At the end of the line a servlet service() method is called. However how is this possible if the service() method of the servlet object can only recieve a request and response objects of type ServletRequest and ServletResponse respectivly!? 
> 
> Does tomcat internally have some mapping functionality to change a Request/Response object of type org.apache.coyote.Request/Response to type javax.servlet.ServletRequest/ServletResponse?
> 
> Sorry if the question may sound stupid. I am not what you call an expert programmer but have spent lots of time to understand how Tomcat works. My final aim is to actually develop my own connector (as I said on the users list).
> 
> btw - I posted this on this mailing list since I am actually extending Tomcat funtionality then just using it. So I tought this was a better place to ask this.
> 
> Thanks & Regards,
> Simon J.
> 
> _________________________________________________________________
> Discover the new Windows Vista
> http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

Discover the new Windows Vista Learn more!

_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

RE: Question about org.apache.coyote.Request

Posted by Simon Aquilina <si...@hotmail.com>.
Hi again,

I continued doing further research on Tomcat and I feel as if Tomcat is not able to support custom developed Protocol Handlers without changing also some code in the Catalina package as well!

I opened the CoyoteAdapter in the Catalina package and here it seems that the service() method takes it for granted that any in coming request is of type Http (since the Request object used in this class extends HttpRequest). This means that if I want to develop a connector for Tomcat completly http independent then I will also have to develop my own CoyoteAdapter and somehow tell Tomcat to use this one! Right? (I accept the fact that i could possible be talking rubish. If so please do tell me - at least I would learn something).

I also cannot understand another thing. If in theory the Http11Protocol class is responsable to handle any http request, then why doesn't this create a Request object of type HttpRequest at that level; rather then let the CoyoteAdapter in the Catalina package do that? (At the moment it seems that the Http11Protocol will create a Request object (which is very similar to the actual HttpRequest) which is then send to the Adapter, which in turn creates an HttpRequest).

Thanks & Regards,
Simon J.





> From: sim085@hotmail.com
> To: dev@tomcat.apache.org
> Subject: Question about org.apache.coyote.Request 
> Date: Fri, 19 Sep 2008 14:13:31 +0200
> 
> Hi,
> 
> I am new in the Tomcat world. However these last few months I tried to understand a little better how tomcat works concentrating mostly on the Connectors (Protocol Handlers) aspect. I now found something which is confusing me a little and I hope someone here can explain to me how this works out.
> 
> When I downloaded the source code and opened org.apache.coyote.Request I found out that this does not inherit from javax.servlet.ServletRequest, nor to any other class. This is confusing me!
> 
> When a request and response objects are constructed, the processor will call the Adapter.process() method which takes the request (org.apache.coyote.Request) and response (org.apache.coyote.Response) objects as parameters. At the end of the line a servlet service() method is called. However how is this possible if the service() method of the servlet object can only recieve a request and response objects of type ServletRequest and ServletResponse respectivly!? 
> 
> Does tomcat internally have some mapping functionality to change a Request/Response object of type org.apache.coyote.Request/Response to type javax.servlet.ServletRequest/ServletResponse?
> 
> Sorry if the question may sound stupid. I am not what you call an expert programmer but have spent lots of time to understand how Tomcat works. My final aim is to actually develop my own connector (as I said on the users list).
> 
> btw - I posted this on this mailing list since I am actually extending Tomcat funtionality then just using it. So I tought this was a better place to ask this.
> 
> Thanks & Regards,
> Simon J.
> 
> _________________________________________________________________
> Discover the new Windows Vista
> http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE