black_panther
black_panther

Reputation: 13

why there are two classes for handling request in Struts 1.3 , ActionServlet and RequestProcessor

Why in struts 1.3 we have two separated classes for handling request :

-- ActionServlet which intercept the request and calls RequestProcessors process method for further processing
--RequestProcessor read XML file, find the appropriate Handler and handles request

My question is why this are two different classes? I tried to search on the net and books but did not got any answer.

Can any one have any idea? please let me know

Upvotes: 1

Views: 3258

Answers (2)

Neeraj Gahlawat
Neeraj Gahlawat

Reputation: 1679

The RequestProcessor Class is the actual place where the request processing takes place in a Struts controller environment.

When the request object first reaches the actionservlet class then it invokes the process method of the underlying RequestProcessor Class.

This process method then looks into the struts-config.xml file and tries to locate the name of the action that has come with the request.Once it identifies the action in the xml file it continues the rest of the steps needed for request processing.

Upvotes: 0

Buhake Sindi
Buhake Sindi

Reputation: 89169

ActionServlet basically reads your struts-config.xml and creates a ModuleConfig. This ModuleConfig is a Object representation of your struts-config.xml. ActionServlet just passes your HttpServletRequest and HttpSerlvetResponse to the RequestProcessor.

The RequestProcessor basically identifies the Action from the request (through the ModuleConfig helper) create an ActionMapping (based on the call one made) and performs executes the necessary action to retrieve an ActionForward. From the ActionForward, it delegates your request and response to it and that's the whole Struts workflow.

Basically, the heart of Struts is through the RequestProcessor. The ActionServlet just initializes Struts as well as passes the request and response to the RequestProcessor.

Upvotes: 2

Related Questions