struts的PrepareOperations

PrepareOperations在StrutsPrepareAndExecuteFilter有用到

其中一个是得到ActionMapping

public ActionMapping findActionMapping(HttpServletRequest request, HttpServletResponse response, boolean forceLookup) {
        ActionMapping mapping = (ActionMapping) request.getAttribute(STRUTS_ACTION_MAPPING_KEY);
        if (mapping == null || forceLookup) {
            try {
                mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
                if (mapping != null) {
                    request.setAttribute(STRUTS_ACTION_MAPPING_KEY, mapping);
                }
            } catch (Exception ex) {
                dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
            }
        }

        return mapping;
    }


如果已经有在request中得得到 没有则创建

key为STRUTS_ACTION_MAPPING_KEY = "struts.actionMapping"

怎么创建?

通过ActionMapper的getMapping方法

你可能感兴趣的:(struts的PrepareOperations)