Monday, 11 April 2016

What are controller components and RequestProcessor ?



Controller
  • responsible for intercepting and translating user input into actions to be performed by the model.
  • responsible for selecting the next view based on user input and the outcome of model operations.
  • receives the request from the browser, invoke a business operation and coordinating the view to return to the client. 
  • implemented by a Java Servlet
  • Centralized point of control for the web application

  • In struts framework, the controller responsibilities are implemented by several different components like :  
    • The ActionServlet Class 
    • The RequestProcess or Class 
    • The Action Class



 
RequestProcessor

The class org.apache.struts.action.requestProcessor process the request from the controller. You can sublass the RequestProcessor with your own version.

Flow
  • Controller receives a client request
  • It delegates the handling of the request to a helper class (Action class)
    This helper knows how to execute the business operation associated with the requested action.
    It acts as a bridge between a client-side user action and business operation.
  • The Action class decouples the client request from the business model.
    This decoupling allows for more than one-to-one mapping between the user request and an action.
  • The Action class also can perform other functions such as authorization, logging before invoking business operation.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.