Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How is RequestDispatcher implemented?  RSS feed

 
Axx Woooo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I'm trying to figure out how to implement a RequestDispatcher, so I checked tomcat's source code, the ApplicationDispatcher class, but there are many places I can't understand.

I found in the ApplicationDispatcher class that the method used to forward request and response to the designated resource is the invoke(ServletRequest,ServletResponse) method, and this part is responsible for executing forward:


I can't understand this part of code, does this mean the RequestDispatcher.forward() and RequestDispatcher.include() methods are all executed in a filterchain? Can anyone tell me the machanism of it?

Thanks in advance!
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if I (or anyone else) understands the question, but I am curious to know, why you want to rewrite request dispatcher?
 
Axx Woooo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praful Thakare wrote:Not sure if I (or anyone else) understands the question, but I am curious to know, why you want to rewrite request dispatcher?


I'm learning java ee now, so I think rewriting and understanding how tomcat implemented these interfaces helps.

About the question, I mean that I don't understand the machanism of RequestDispatcher forwarding request or including resources, thus I hope someone can tell me some details of how to forward request or include resource via RequestDispatcher.
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm learning java ee now, so I think rewriting and understanding how tomcat implemented these interfaces helps.


Really? IMHO that will take you ages to learn java and not sure if it will add any significant knowledge by knowing how its done, I am personally worried about what the api should do, at max read the JSR, but if that's your style then so be it
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think that this is a very useful exercise. While it is good (very good) to understand how the servlet API works from a black box point of view, getting bogged down in the white-box implementation details is time I feel would be better spent learning how to structure and implement web apps properly. YMMV.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!