Extension Struts ActionServlet and RequestProcessor

Can someone tell me a scenario in which I have to expand ActionServletand RequestProcessor? I read in the Struts documentation that this can be done, but I do not understand in what situation.

+3
source share
1 answer

ActionServlet and RequestDispatcher are the main players in the Struts framework. ActionServlet processes all requests made in your Struts application and delegates the "heavy lift" of request processing to the RequestProcessor object.

In the Struts application, you usually perform your operations by creating Action classes, each Action takes care of its own things. Sometimes, although you want to perform common operations for all activities such as logging or security , and you do not want them to be executed inside each Action class, do you? This will mean a lot of code duplication, so you should place this normal behavior somewhere above the individual actions.

ActionServlet and RequestProcessors make good candidates for such things. Of course, you can write a filter, but ActionServlet and RequestProcessors already contain code related to your structure, so it makes no sense to start from scratch something when you can reuse what already exists and extend it.

RequestProcessor (, ActionServlet), JavaDoc RequestProcessor, , .

: Tiles Plugin RequestProcessor.

+1

Source: https://habr.com/ru/post/1768453/


All Articles