protected UrlReverseOption customizeActionUrlReverse(Class<?> actionType, UrlChain chain) { final UrlReverseOption option = actionAdjustmentProvider.customizeActionUrlReverse(createUrlReverseResource(actionType, chain)); return option != null ? option : EMPTY_URL_REVERSE_OPTION; }
protected ResponseReflectingOption adjustResponseReflecting() { // not null final ResponseReflectingOption option = adjustmentProvider.adjustResponseReflecting(); return option != null ? option : NULLOBJ_REFLECTING_OPTION; } }
/** * Convert to URL string to move the action. <br> * e.g. ProductListAction to /product/list/ <br> * And not contain context path. * @param actionType The class type of action that it redirects to. (NotNull) * @return The URL string to move to the action. (NotNull) */ public String toActionUrl(Class<?> actionType) { assertArgumentNotNull("actionType", actionType); return toActionUrl(actionType, EMPTY_URL_CHAIN); }
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 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; }
/** * Handle the action path from the specified request path. * @param requestPath The request path to be analyzed. (NotNull) * @param handler The handler of the action path when the action is found. (NotNull) * @return Is it actually handled? (false if not found) * @throws Exception When the handler throws or internal process throws. */ public boolean handleActionPath(String requestPath, ActionFoundPathHandler handler) throws Exception { assertArgumentNotNull("requestPath", requestPath); assertArgumentNotNull("handler", handler); final MappingPathResource pathResource = customizeActionMapping(requestPath); return mappingActionPath(pathResource, handler); }
public String resolveActionPath(Class<?> actionType, UrlReverseOption option) { final String simpleActionName = toSimpleActionName(actionType, option); // productList (from ProductListAction.class) return URL_DELIMITER + decamelize(simpleActionName, URL_DELIMITER) + URL_DELIMITER; // e.g. '/product/list/' }
protected MappingPathResource customizeActionMapping(String requestPath) { final String simplyFiltered = simplyCustomizeActionMappingRequestPath(requestPath); return deeplyCustomizeUrlMapping(requestPath, simplyFiltered); }
protected String simplyCustomizeActionMappingRequestPath(String requestPath) { final String customized = actionAdjustmentProvider.customizeActionMappingRequestPath(requestPath); return customized != null ? customized : requestPath; }
protected UrlReverseResource createUrlReverseResource(Class<?> actionType, UrlChain chain) { return new UrlReverseResource(actionType, chain); }
public FormMappingOption indefinableParameters(String... indefinableParameters) { indefinableParameterSet = createIndefinableParameterSet(indefinableParameters); return this; }
protected List<String> prepareHtmlRetryWordList(String requestPath, List<String> wordList) { return actionAdjustmentProvider.prepareHtmlRetryWordList(requestPath, wordList); }
protected void adjustActionResponseJustBefore(ActionResponse response) { adjustmentProvider.adjustActionResponseJustBefore(runtime, response); }
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); }
/** * Convert to URL string to move the action. <br> * e.g. ProductListAction to /product/list/ <br> * And not contain context path. * @param actionType The class type of action that it redirects to. (NotNull) * @return The URL string to move to the action. (NotNull) */ public String toActionUrl(Class<?> actionType) { assertArgumentNotNull("actionType", actionType); return toActionUrl(actionType, EMPTY_URL_CHAIN); }
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 UrlReverseOption customizeActionUrlReverse(Class<?> actionType, UrlChain chain) { final UrlReverseOption option = actionAdjustmentProvider.customizeActionUrlReverse(createUrlReverseResource(actionType, chain)); return option != null ? option : EMPTY_URL_REVERSE_OPTION; }
public String resolveActionPath(Class<?> actionType, UrlReverseOption option) { final String simpleActionName = toSimpleActionName(actionType, option); // productList (from ProductListAction.class) return URL_DELIMITER + decamelize(simpleActionName, URL_DELIMITER) + URL_DELIMITER; // e.g. '/product/list/' }
protected ResponseReflectingOption adjustResponseReflecting() { // not null final ResponseReflectingOption option = adjustmentProvider.adjustResponseReflecting(); return option != null ? option : NULLOBJ_REFLECTING_OPTION; } }
protected String simplyCustomizeActionMappingRequestPath(String requestPath) { final String customized = actionAdjustmentProvider.customizeActionMappingRequestPath(requestPath); return customized != null ? customized : requestPath; }