public String prepareExpectedRoutingMessage(String requestPath) { // for debug final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("/= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = *No routing action:\n"); sb.append("e.g. expected actions for ").append(requestPath).append("\n"); final MappingPathResource pathResource = customizeActionMapping(requestPath); final List<String> nameList = buildExpectedRoutingActionList(pathResource.getMappingPath()); boolean exists = false; for (String name : nameList) { if (name.endsWith("@index()") && containsNotAllowedCharacterAsActionPath(requestPath)) { // e.g. /product/List/ continue; } final String packageExp = Srl.substringLastFront(name, "."); if (!containsNotAllowedCharacterAsActionPath(packageExp)) { sb.append(" web.").append(name).append("\n"); exists = true; } } if (exists) { sb.append(" (and so on...)\n"); } else { sb.append(" *no suggestion... e.g. cannot use upper case in action path\n"); } sb.append("= = = = = = = = = =/"); return sb.toString(); }
protected boolean executeHandlerIfFound(MappingPathResource pathResource, ActionFoundPathHandler handler, String actionName, String paramPath) throws Exception { final boolean emptyParam = paramPath == null || paramPath.isEmpty(); final ActionExecute execByParam = !emptyParam ? findExecuteConfig(actionName, paramPath).orElse(null) : null; if (emptyParam || execByParam != null) { // certainly hit final String requestPath = pathResource.getRequestPath(); // no mapping, plain path here (for e.g. redirect) return handler.handleActionPath(requestPath, actionName, paramPath, execByParam); } return false; }
protected boolean mappingActionPath(MappingPathResource pathResource, ActionFoundPathHandler handler) throws Exception { final String mappingPath = pathResource.getMappingPath(); final String[] names = LdiStringUtil.split(mappingPath, URL_DELIMITER); // e.g. [sea, land] if /sea/land/ final LaContainer root = container.getRoot(); // because actions are in root
protected boolean mappingActionPath(MappingPathResource pathResource, ActionFoundPathHandler handler) throws Exception { final String mappingPath = pathResource.getMappingPath(); final String[] names = LdiStringUtil.split(mappingPath, URL_DELIMITER); // e.g. [sea, land] if /sea/land/ final LaContainer root = container.getRoot(); // because actions are in root
public String prepareExpectedRoutingMessage(String requestPath) { // for debug final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("/= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = *No routing action:\n"); sb.append("e.g. expected actions for ").append(requestPath).append("\n"); final MappingPathResource pathResource = customizeActionMapping(requestPath); final List<String> nameList = buildExpectedRoutingActionList(pathResource.getMappingPath()); boolean exists = false; for (String name : nameList) { if (name.endsWith("@index()") && containsNotAllowedCharacterAsActionPath(requestPath)) { // e.g. /product/List/ continue; } final String packageExp = Srl.substringLastFront(name, "."); if (!containsNotAllowedCharacterAsActionPath(packageExp)) { sb.append(" web.").append(name).append("\n"); exists = true; } } if (exists) { sb.append(" (and so on...)\n"); } else { sb.append(" *no suggestion... e.g. cannot use upper case in action path\n"); } sb.append("= = = = = = = = = =/"); return sb.toString(); }
protected MappingPathResource deeplyCustomizeUrlMapping(String requestPath, String simplyFiltered) { final UrlMappingOption option = actionAdjustmentProvider.customizeActionUrlMapping(createUrlMappingResource(requestPath)); final String mappingPath; final String actionNameSuffix; if (option != null) { mappingPath = option.getRequestPathFilter().map(filter -> filter.apply(simplyFiltered)).orElse(simplyFiltered); actionNameSuffix = option.getActionNameSuffix().orElse(null); } else { mappingPath = simplyFiltered; actionNameSuffix = null; } return new MappingPathResource(requestPath, mappingPath, actionNameSuffix); }
protected String buildActionName(MappingPathResource mappingResource, String pkg, String classPrefix) { final String actionNameSuffix = mappingResource.getActionNameSuffix().orElse(""); // option so basically empty final String actionSuffix = namingConvention.getActionSuffix(); // e.g. 'Action' return (pkg != null ? pkg : "") + classPrefix + actionNameSuffix + actionSuffix; // e.g. sea_seaLandAction, sea_seaLandSpAction }
protected boolean executeHandlerIfFound(MappingPathResource pathResource, ActionFoundPathHandler handler, String actionName, String paramPath) throws Exception { final boolean emptyParam = paramPath == null || paramPath.isEmpty(); final ActionExecute execByParam = !emptyParam ? findExecuteConfig(actionName, paramPath).orElse(null) : null; if (emptyParam || execByParam != null) { // certainly hit final String requestPath = pathResource.getRequestPath(); // no mapping, plain path here (for e.g. redirect) return handler.handleActionPath(requestPath, actionName, paramPath, execByParam); } return false; }
protected String buildActionName(MappingPathResource mappingResource, String pkg, String classPrefix) { final String actionNameSuffix = mappingResource.getActionNameSuffix().orElse(""); // option so basically empty final String actionSuffix = namingConvention.getActionSuffix(); // e.g. 'Action' return (pkg != null ? pkg : "") + classPrefix + actionNameSuffix + actionSuffix; // e.g. sea_seaLandAction, sea_seaLandSpAction }
protected MappingPathResource deeplyCustomizeUrlMapping(String requestPath, String simplyFiltered) { final UrlMappingOption option = actionAdjustmentProvider.customizeActionUrlMapping(createUrlMappingResource(requestPath)); final String mappingPath; final String actionNameSuffix; if (option != null) { mappingPath = option.getRequestPathFilter().map(filter -> filter.apply(simplyFiltered)).orElse(simplyFiltered); actionNameSuffix = option.getActionNameSuffix().orElse(null); } else { mappingPath = simplyFiltered; actionNameSuffix = null; } return new MappingPathResource(requestPath, mappingPath, actionNameSuffix); }