jeudi 13 septembre 2018

What is FrontController design pattern? How much level is DispatcherServlet using it in Spring?

Actually i am trying to understand the DispatcherServlet and came to know that it is following the FrontController Design Pattern. While trying to understand the FrontController design pattern came across this link FrontController from Oracle Doc reference Not much understood as i am beginner,but few things I understood Like Below

If we don't have FrontController we often try to duplicate the code in multiple controller like authentication and Authorization. And because of which maintainability becomes a big issue if we want to change something in future. so having frontController in place we can move the basic functionality to frontController and changes can be done easily.

When I explained Same thing in the interview he asked me what are those basic functionalities. I told Internalization , viewResolver,Authentication,Authorization etc.. and now again asked consider like there is no dispatcher Servlet how do you handle those functionalities in each controller ?

Since am basically a Desktop Application developer i couldn't answer for his next question.

So here are my questions

  1. Firstly Is my understanding Correct ?
  2. If my understand is correct, how to answer for the second question of the Interviewer? which is consider like if there is no dispatcher Servlet how do you handle those functionalities in each controller ? means asked me to write some pseudo code of the common functionalities. which i couldn't as i am swing developer. could someone please explain me with some sample code which we repeat across the controller and now with dispatcher we could avoid.

Thanks in Advance for your time spent on this thread!!

Aucun commentaire:

Enregistrer un commentaire