bostrick
7 years agoContributor
Obtaining the sso_id as a string in a macro?
I'm new to the world of lithium programming... any help on the following would be appreciated.
I'm working on an api request which I want to parameterize with a user's sso_id.
Not finding the sso_id on the Freemarker User context object, I'm resorting to the rest() context object to pull the info...
<#assign sso_id=rest("/authentication/sessions/current/user/sso_id").value />
This suffices for text context, where the following works...
sso_id: ${sso_id}
But if I try to pass this into another function, bad things happen. Any ideas on how to cast a extended node+sequence+hash+string (!!) as a string?
<#assign req = req.parameter("username", sso_id) />
FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)
No compatible overloaded variation was found; declared parameter types and argument value types mismatch. The FTL type of the argument values were: string (wrapper: f.t.SimpleScalar), extended node+sequence+hash+string (org.apache.xerces.dom.ElementImpl wrapped into f.e.dom.ElementModel). The Java type of the argument values were: String, org.apache.xerces.dom.ElementImpl. The matching overload was searched among these members: lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel.parameter(String, Iterable), lithium.coreapi.webui.template.models.HttpClientRequestTemplateModel.parameter(String, String) ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign req = req.parameter("username... [in template "ole.this_breaks.ftl" at line 14, column 1]