URL encoding the entity ID in Velocity
Brent Putman
putmanb at georgetown.edu
Wed Feb 3 14:55:11 EST 2016
On 2/3/16 2:33 PM, Wessel, Keith wrote:
> Thanks, Scott. An excellent enhancement. I wondered exactly what the "custom" variable meant at the top in the comments.
>
> I'm having some trouble getting it working. I've uncommented the block you mentioned in global.xml and set the key to urlEncoder, the value to java.net.URLEncoder. I restarted Jetty to re-read global.xml. But when I put $urlEncoder.encode("$entityID", "utf-8") in my login.vm, Velocity gives me back a literal string. Same for when I make it $custom.urlEncoder.encode("$entityID","utf-8").
>
> What am I doing wrong?
The bean is exposed in the template as a variable called "custom". [1]
For some detailed discussion and examples, see the original Jira issue. [2]
Since in this case the custom object is a Map, if you defined an entry
in the map with key "foo", you reference in the Velocity template like:
$custom.get("foo")
and Velocity supports some syntactic sugar variations for some types,
like lists arrays and maps:
$custom["foo"]
Full usage possibilities you can glean from the Velocity user guide
docs. [3]
[1] https://wiki.shibboleth.net/confluence/display/IDP30/VelocityVariables
[2] https://issues.shibboleth.net/jira/browse/IDP-774
[3]
https://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20160203/9675921d/attachment.html>
More information about the users
mailing list