• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How is RequestDispatcher implemented?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic