From 0a56667093856ef454bcc50dc6dc3b1a8263ebe3 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 8 Mar 2016 17:07:59 +0100 Subject: [PATCH] Fix SpringUrl Velocity macro URI encoding Prior to this commit, the springUrl Velocity macro would only prepend the context to the given URL; this means that the ServletHttpResponse.encodeUri method is not called and neither the ResourceUrlProvider. This commit changes this macro to use RequestContext.getContextUrl which prepends the context and encodes the URI. Issue: SPR-14027 --- .../org/springframework/web/servlet/view/velocity/spring.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/view/velocity/spring.vm b/spring-webmvc/src/main/resources/org/springframework/web/servlet/view/velocity/spring.vm index 9064115ee1..91936429ad 100644 --- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/view/velocity/spring.vm +++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/view/velocity/spring.vm @@ -55,7 +55,7 @@ * Takes a relative URL and makes it absolute from the server root by * adding the context root for the web application. *# -#macro( springUrl $relativeUrl )$springMacroRequestContext.getContextPath()${relativeUrl}#end +#macro( springUrl $relativeUrl )$springMacroRequestContext.getContextUrl(${relativeUrl})#end #** * springBind