URL encoding the entity ID in Velocity

Brent Putman putmanb at georgetown.edu
Wed Feb 3 16:01:03 EST 2016



On 2/3/16 3:51 PM, Cantor, Scott wrote:
> On 2/3/16, 3:29 PM, "users on behalf of Wessel, Keith" <users-bounces at shibboleth.net on behalf of kwessel at illinois.edu> wrote:
>
>
>
>> I've tried, and I'm closer, but I think I still need a hint for bean creation. I've got a bean with an id element of custom.urlEncoder and a class of java.net.URLEncoder.
> It only has static methods, I'm not sure what you get from calling a static method on a class instance like that. If that works, then your problem might just be the Velocity part and how you named it.

See my other note, but: actually that might work.  I can't see that
java.net.URLEncoder has anything to *prevent* instantiation.  So if you
can create an instance, I think you can still call static methods on
it.  Injecting the java.land.Class instance still feels more right,
though, for using static methods.


>> I'm assuming it needs some properties associated with it. Because, if I try to use it in my login template as:
>>
>> $custom(urlEncoder).encode("$entityID","utf-8")
> Brent mentioned you can use brackets if the bean called "custom" is defined to be a map, but I don't think you can use parentheses to access a named element in a map.

I missed that in other note.  No, you can' do that AFAIK.  You either
call the get("..") method, or you use the square bracket index
notation.  Not parens alone.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20160203/fbf61589/attachment-0001.html>


More information about the users mailing list