File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Component dispatcher sevlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Component dispatcher sevlet" Watch "Component dispatcher sevlet" New topic
Author

Component dispatcher sevlet

Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hi all,

What is a Component dispatcher sevlet? and how it works?

If the question is too basic give me some pointers where I could look in for more info.

Thanks,


Kriss.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I got zero Google hits on "component dispatcher servlet", but plenty on "dispatcher servlet". Where did you find the term?

Any number of frameworks send all HTML requests to a single servlet, use the URL or hidden fields to decide what object should get control next, and dispatch to that object. Does that fit what you expected?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hey Stan,

you hit the bulls eye, Thanks a lot.

And I want to know why all the frameworks need to direct all html requests thru this dispatcher servlet, is it necessary or any other alternatives to it?

I came across this term in Documentum 'application development framwork'.

Thanks again.
Vani Nandeesh
Greenhorn

Joined: Mar 31, 2005
Posts: 3
It is the best practice to use MVC design pattern. Model-View-Controller. If you send all the forum requests to a single servlet,then that servlet becomes the controller for the flow. So in this way,if you want to make modification to the view,it doesn't affect the controller and the model.
Hope this answers your question.
Vani.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

BTW: your entire app doesn't have to go through one servlet.

I have a controller for each component.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Vani Nandeesh
Greenhorn

Joined: Mar 31, 2005
Posts: 3
If you have multiple controllers, then do you have another servlet to control the flow to theses servlets.
How does it work?

Thanks.
Heonkoo Lee
Ranch Hand

Joined: Feb 10, 2005
Posts: 85
Originally posted by Vani Nandeesh:
If you have multiple controllers, then do you have another servlet to control the flow to theses servlets.
How does it work?

Thanks.


I can think of it two ways. You can have a front controller, which is mapped to all the URL's, to forward requests to second level controllers based on some parameter values or request uri, then those controllers take care of their specific job and forward to appropriate view components. The other way is that you can map separate urls to separate servlets so that each servlet can process its designated url request. This is probably what Ben mentioned. Struts action mapping technique seems like using the former way.

Sometimes mix of front controller and MVC pattern can be useful.

Regards
Srinivas Ivaturi
Ranch Hand

Joined: Jan 28, 2003
Posts: 50
In this case I support lee to have Front Controller where all the requests come into application thru one way. Then we can have Component Level Dispatchers wherein these are again Servlets but invoked based on the Parameters. May be you can name this as "Component Dispatcher Servlet".



Srinivas Ivaturi.
Vani Nandeesh
Greenhorn

Joined: Mar 31, 2005
Posts: 3
Thanks Lee and Srinivas. My question is answered.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Running all requests through a single servlet gives you a neat place to put common security, performance monitoring and a bunch of other useful control stuff. Some designs have a servlet per page and even though they still act as controllers that makes it a little less easy to manage some of those common things across all pages.

Some people prefer to do to this common stuff in filters, a rather newer concept in servlet engines. I gotta look into that some day.
Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Thanks All.

Have a nice weekend.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Component dispatcher sevlet