<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<div class="moz-cite-prefix">On 2/3/16 3:29 PM, Wessel, Keith wrote:<br>
</div>
<blockquote
cite="mid:A1EB7EC659FA0F429A55865D5820006D2E4212DD@CITESMBX1.ad.uillinois.edu"
type="cite">
<pre wrap="">
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.
<bean id="custom.urlEncoder" class="java.net.URLEncoder" /></pre>
</blockquote>
<br>
I don't know where you're putting that, but that doesn't look
correct for the Map-based bean we have commented in global.xml. The
general pattern would be like this:<br>
<br>
<tt> <util:map id="shibboleth.CustomViewContext"></tt><tt><br>
</tt><tt> <entry key="urlEncoder"></tt><tt><br>
</tt><tt> .... </tt><tt><br>
</tt><tt> </entry></tt><tt><br>
</tt><tt> </util:map></tt><br>
<br>
<br>
And then you access in the template like $custom.get("urlEncoder")
OR $custom["urlEncoder"].<br>
<br>
However...<br>
<br>
In thinking about your actual use case... This is
java.net.URLEncoder. You don't instantiate it, you're just calling
a static method.<br>
<br>
I've never personally done that in Velocity. In searching, I think
what you need to do is inject a bean that is a java.lang.Class
instance. They apparently added support for that in Velocity 1.6
[1].<br>
<br>
Given the Spring wiring requirement here (i.e. not modifying Java
code), I think you'd want something like this [2]:<br>
<br>
<tt> <util:map id="shibboleth.CustomViewContext"></tt><tt><br>
</tt><tt> <entry key="urlEncoder"></tt><tt><br>
</tt><tt> <value
type="java.lang.Class">java.net.URLEncoder</value></tt><tt><br>
</tt><tt> </entry></tt><tt><br>
</tt><tt> </util:map></tt><br>
<br>
<br>
I don't have an immediate way to test. Please give it a try and let
us know how it works out.<br>
<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/2329191/calling-class-methods-static-from-inside-a-velocity-view-page">http://stackoverflow.com/questions/2329191/calling-class-methods-static-from-inside-a-velocity-view-page</a><br>
[2]
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/1601015/spring-syntax-for-setting-a-class-object">http://stackoverflow.com/questions/1601015/spring-syntax-for-setting-a-class-object</a><br>
</body>
</html>