zoukankan      html  css  js  c++  java
  • struts深入原理之RequestProcessor与xml

    和配置文件相对应的代码(struts1) 

    public void process(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
            // Wrap multipart requests with a special wrapper
            request = processMultipart(request);

            // Identify the path component we will use to select a mapping
            String path = processPath(request, response);

            if (path == null) {
                return;
            }

            if (log.isDebugEnabled()) {
                log.debug("Processing a '" + request.getMethod() + "' for path '"
                    + path + "'");
            }

            // Select a Locale for the current user if requested
            processLocale(request, response);

            // Set the content type and no-caching headers if requested
            processContent(request, response);
            processNoCache(request, response);

            // General purpose preprocessing hook
            if (!processPreprocess(request, response)) {
                return;
            }

            this.processCachedMessages(request, response);

            // Identify the mapping for this request
            ActionMapping mapping = processMapping(request, response, path);

            if (mapping == null) {
                return;
            }

            // Check for any role required to perform this action
            if (!processRoles(request, response, mapping)) {
                return;
            }

            // Process any ActionForm bean related to this request
            ActionForm form = processActionForm(request, response, mapping);

            processPopulate(request, response, form, mapping);

            // Validate any fields of the ActionForm bean, if applicable
            try {
                if (!processValidate(request, response, form, mapping)) {
                    return;
                }
            } catch (InvalidCancelException e) {
                ActionForward forward = processException(request, response, e, form, mapping);
                processForwardConfig(request, response, forward);
                return;
            } catch (IOException e) {
                throw e;
            } catch (ServletException e) {
                throw e;
            }

            // Process a forward or include specified by this mapping
            if (!processForward(request, response, mapping)) {
                return;
            }

            if (!processInclude(request, response, mapping)) {
                return;
            }

            // Create or acquire the Action instance to process this request
            Action action = processActionCreate(request, response, mapping);

            if (action == null) {
                return;
            }

            // Call the Action instance itself
            ActionForward forward =
                processActionPerform(request, response, action, form, mapping);

            // Process the returned ActionForward instance
            processForwardConfig(request, response, forward);
        }

  • 相关阅读:
    Spring Could not find unique TaskExecutor bean 错误
    Postman 测试 API 如何上传文件
    Spring Boot 项目上传日志到 Azure Application Insights
    Spring Boot 和 Hibernate 的 H2 数据库配置来进行启动测试
    android TextView多行数据显示
    MarkDown 查看器 typora
    Ubuntu16.04多个版本python编译器的安装和切换
    关于LPC824Lite开发板下载程序时提示"Invalid ROM Table"
    8寸防震三防平板电脑Windows/安卓
    HaaS100 OLED信息屏显示案例
  • 原文地址:https://www.cnblogs.com/davidwang456/p/3164217.html
Copyright © 2011-2022 走看看