Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springUrl Velocity macro should encode the given URI using the response [SPR-14027] #18599

Closed
spring-issuemaster opened this issue Mar 8, 2016 · 0 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Mar 8, 2016

Brian Clozel opened SPR-14027 and commented

Spring provides ways to rewrite resource URLs using the ResourceUrlEncodingFilter and ResourceUrlProvider. By using the HttpServletResponse.encodeUrl method, supported template engines can trigger that mechanism to rewrite the resource URL.

The dedicated Velocity macros provided by Spring, springUrl only prepends the URL with the context, instead of calling the actual method RequestContext.getContextUrl; this is actually done for the Freemarker equivalent.

In the meantime, developers who want this feature should override Spring's macro or declare their own like this:

#macro( springResourceUrl $relativeUrl )$springMacroRequestContext.getContextUrl(${relativeUrl})#end

Affects: 4.2.5

Reference URL: http://stackoverflow.com/questions/35844482/how-to-use-spring-resourceurlencodingfilter-with-velocity-template

Issue Links:

  • #9845 Binding in Velocity templates using EL accessors ([, ]) for collections produces non xhtml strict compliant output

Referenced from: commits 0a56667, f76b38c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.