How to convert variable to UrlType in Script Mapper

When calling keycloakSession.getContext().getUri(UrlType) I want to pass ‘BACKEND’ as UrlType.
How can I create a variable of type UrlType in the mapper for passing it to the method.
How does the method work?
The documentation is for Java but language used is JavaScript. How is it translated?

maybe this way:

UrlType = Java.type("org.keycloak.urls.UrlType");

with myJavaType = Java.type(""); you can import standard Java classes you need. That’s very usefull in scripting.

1 Like

Both ways worked like a charm. Thank you!

Further documentation can be found here: