How to get the current Application URL

1
Hi  I have configured several custom domains in my application and want to figure out, which url was launched. The GetApplicationUrl Action from the Community Common gives me only the getApplicationRootUrl, but i need the current URL. I need this inside a microflow, so i can decide which login page i prevent to the user. How can i solve this? Thanks Stephan  
asked
3 answers
1

Do you need the full URL, or just the domain name of the current site?

If it’s just domain name, then we use a Java Action called from a microflow to get this.

IContext ctx = getContext();
IMxRuntimeRequest request = ctx.getRuntimeRequest().get();
HttpServletRequest servletRequest = request.getHttpServletRequest();
java.net.URL aURL = new java.net.URL(servletRequest.getRequestURL().toString());
return aURL.getHost();

As I said, It won’t get you the full URL as it will always return the /xas request to the microflow, but you can get the domain name.

If you need the port number as well in the URL, then change the last line to getAuthority instead of getHost.

Hope this helps.

answered
0

Possible way i see is that you trigger your microflow from whitin a nanoflow, wich gives you the oppertunity to get the URL by a javascript action.

window.location.href

answered
0

It’s a bit in the dark why you need the current URL and what you want to do with this value. But could you add a dataview with a nanoflow as datasource, to return the URL as David describes?

 

answered