RequestProcessor's Process ()

xiaoxiao2021-03-06  57

The processMultipart () method is called. If the HttpServletRequest method is a POST and the contentType of the request starts with multipart / form-data, the standard request object is wrapped with a special version from the Struts framework that deals exclusively with multipart requests. If the request method is a GET or the contentType is not multipart, the original request is returned. Unless your application supports uploading files, you do not need to worry about multipart functionality in Struts. The processPath () method is called to determine the path component from the URI for the request. Among other things, this information is used to select the appropriate Struts Action to invoke. The processLocale () method is called to determine the locale of the user making the request and to store a Locale object into The User's HttpSession Object. The Locale Isn't Always Obtained INTO The User's Session-IT Depends on The Locale Attribute In The Controller Configuration Element. See Chapte r 4 for more details on the attributes of the controller element. Determine the content type and optional encoding of the request by calling the processContent () method. The content type may be configured in the configuration settings and also overridden by the JSPs. The default content type is text / html. The processNoCache () method is called to determine whether the noCache attribute is set to true. If it is, add the proper header parameters in the response object to prevent the pages from being cached in the browser. The Header Parameters include Pragma, Cache-Control, And Expires. The processpreprocess () Method Is Called Next. IT '

sa general-purpose preprocessing hook that, by default, just returns true. However, subclasses can override this method and perform conditional logic to decide whether to continue processing the request. Because this method gets called before an Action is invoked, this is a good place to validate whether the user contains a valid session. If this method returns true, processing of the request will continue. If it returns false, processing will stop. It's up to you to programmatically redirect or forward the request-the controller will assume that you are handling the request and will not send a response to the client. Determine the ActionMapping for the request using the path information by calling the processMapping () method. If a mapping can not be found using the path information, an error response will Be returned to the client. Check to see if any security roles are configured for the action by calling the processroles () method. if it is used Method Is Called on The Request. if the user doesn '

t contain the necessary role, processing will end here and an appropriate error message will be returned to the client. Call the processActionForm () method to determine whether an ActionForm is configured for the ActionMapping. If an ActionForm has been configured for the mapping, an attempt will be made to find an existing instance in the appropriate scope. Once an ActionForm is either found or created, it is stored within the proper scope using a key that is configured in the name attribute for the Action element. The processPopulate () method is called next, and if an ActionForm is configured for the mapping, its properties are populated from the request parameter values. Before the properties are populated from the request, however, the reset () method is called on the ActionForm. The processValidate () Method is called, and if an actionform Has been configured and the validate attribute is set to true for the action element d detects errors, it will store an ActionErrors object into the request scope, and the request automatically will be forwarded to the resource specified by the input attribute for the action mapping. If no errors were detected from the validate () method or there was no ActionForm for the action mapping, processing of the request continues. You can configure the controller element to interpret the input attributes as defined forwards. See Chapter 4 for more information on this feature. Determine if a forward or an include attribute is configured for the action Mapping. if So, Call The Forward () or include () Method on The RequestDispatcher, Depending On Which One IS Configured.

转载请注明原文地址:https://www.9cbs.com/read-117193.html

New Post(0)