/** * Create the target URL and, if necessary, pre-pend the contextPath, expand * URI template variables, append the current request query, and apply the * configured {@link #getRequestDataValueProcessor() * RequestDataValueProcessor}. */ protected final String createTargetUrl(Map<String, Object> model, ServerWebExchange exchange) { String url = getUrl(); Assert.state(url != null, "'url' not set"); ServerHttpRequest request = exchange.getRequest(); StringBuilder targetUrl = new StringBuilder(); if (isContextRelative() && url.startsWith("/")) { targetUrl.append(request.getPath().contextPath().value()); } targetUrl.append(url); if (StringUtils.hasText(targetUrl)) { Map<String, String> uriVars = getCurrentUriVariables(exchange); targetUrl = expandTargetUrlTemplate(targetUrl.toString(), model, uriVars); } if (isPropagateQuery()) { targetUrl = appendCurrentRequestQuery(targetUrl.toString(), request); } String result = targetUrl.toString(); RequestDataValueProcessor processor = getRequestDataValueProcessor(); return (processor != null ? processor.processUrl(exchange, result) : result); }
@Override public Map<String, String> getExtraHiddenFields() { if (this.requestDataValueProcessor == null) { // The presence of a Request Data Value Processor is optional return null; } return this.requestDataValueProcessor.getExtraHiddenFields(this.exchange); }
@Override public String processAction(final String action, final String httpMethod) { if (this.requestDataValueProcessor == null) { // The presence of a Request Data Value Processor is optional return action; } return this.requestDataValueProcessor.processAction(this.exchange, action, httpMethod); }
@Override public String processFormFieldValue(final String name, final String value, final String type) { if (this.requestDataValueProcessor == null) { // The presence of a Request Data Value Processor is optional return value; } return this.requestDataValueProcessor.processFormFieldValue(this.exchange, name, value, type); }
@Override public String processUrl(final String url) { if (this.requestDataValueProcessor == null) { // The presence of a Request Data Value Processor is optional return url; } return this.requestDataValueProcessor.processUrl(this.exchange, url); }
/** * Create the target URL and, if necessary, pre-pend the contextPath, expand * URI template variables, append the current request query, and apply the * configured {@link #getRequestDataValueProcessor() * RequestDataValueProcessor}. */ protected final String createTargetUrl(Map<String, Object> model, ServerWebExchange exchange) { StringBuilder targetUrl = new StringBuilder(); if (isContextRelative() && getUrl().startsWith("/")) { targetUrl.append(exchange.getRequest().getContextPath()); } targetUrl.append(getUrl()); if (StringUtils.hasText(targetUrl)) { Map<String, String> uriVars = getCurrentUriVariables(exchange); targetUrl = expandTargetUrlTemplate(targetUrl.toString(), model, uriVars); } if (isPropagateQuery()) { targetUrl = appendCurrentRequestQuery(targetUrl.toString(), exchange.getRequest()); } String result = targetUrl.toString(); RequestDataValueProcessor processor = getRequestDataValueProcessor(); return (processor != null ? processor.processUrl(exchange, result) : result); }