@Test void testSplitActionPath() { assertTrue(Arrays.equals(new String[]{"qqq"}, MadvocUtil.splitActionPath("/qqq"))); assertTrue(Arrays.equals(new String[]{"qqq", "www"}, MadvocUtil.splitActionPath("/qqq/www"))); assertTrue(Arrays.equals(new String[]{"qqq", "www", "eee"}, MadvocUtil.splitActionPath("/qqq/www/eee"))); }
/** * Creates new action request and action object. */ public ActionRequest(String actionPath, ActionConfig config, Object action, HttpServletRequest servletRequest, HttpServletResponse servletResponse) { this.actionPath = actionPath; this.actionPathChunks = MadvocUtil.splitActionPath(actionPath); this.config = config; this.servletRequest = servletRequest; this.servletResponse = servletResponse; totalInterceptors = (this.config.interceptors != null ? this.config.interceptors.length : 0); interceptorIndex = 0; this.action = action; }
public ActionConfigSet(String actionPath) { this.actionPath = actionPath; this.actionPathChunks = MadvocUtil.splitActionPath(actionPath); this.actionPathMacros = resolveMacros(actionPathChunks); }
/** * Performs action config lookup from action path and http request method. * Lookups action configuration from action path and resolves * unregistered paths. Lookup may be optionally disabled if mapping is not used. */ public ActionConfig resolveActionConfig(String actionPath, String method) { String[] actionPathChunks = MadvocUtil.splitActionPath(actionPath); ActionConfig cfg = actionsManager.lookup(actionPath, actionPathChunks, method); if ((cfg == null) && madvocConfig.isActionPathMappingEnabled()) { String packageRoot = madvocConfig.getRootPackage(); if (packageRoot != null) { cfg = registerActionPath(actionPath, packageRoot); // cfg = actionsManager.lookup(actionPath, actionPathChunks); } } if ((cfg == null) && madvocConfig.getSupplementAction() != null) { cfg = registerSupplementAction(actionPath); // cfg = actionsManager.lookup(actionPath, actionPathChunks); } return cfg; }