Open Link in the same tab with Java Action Call

0
I pasted my code below. I am able to open the link in a different tab, but I am tasked to open the link in the same tab.   // This file was generated by Mendix Studio Pro. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package saml20.actions; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.webui.CustomJavaAction; public class EnforceTimeoutSession_JavaAction extends CustomJavaAction<java.lang.Boolean> { public EnforceTimeoutSession_JavaAction(IContext context) { super(context); } @java.lang.Override public java.lang.Boolean executeAction() throws Exception { // BEGIN USER CODE //Logout user from Mendix App com.mendix.core.Core.logout(getContext().getSession()); com.mendix.webui.FeedbackHelper.addLogoutFeedback(getContext()); //Logout user from SSO Provider java.net.URI uri = new java.net.URI("https://ssoprovider.domain.com/ext/logout/Standard"); java.awt.Desktop desktop = java.awt.Desktop.isDesktopSupported() ? java.awt.Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { try { desktop.browse(uri); } catch (java.io.IOException e) { throw new IllegalStateException("Problem opening " + uri.toString(), e); } } return true; // END USER CODE } /** * Returns a string representation of this action */ @java.lang.Override public java.lang.String toString() { return "EnforceTimeoutSession_JavaAction"; } // BEGIN EXTRA CODE // END EXTRA CODE }  
asked
1 answers
2

According to the docs, it's not supported in the Desktop Class. You can only launch the browser itself.

https://docs.oracle.com/javase/7/docs/api/java/awt/Desktop.html

Why not use a ‘ShowPage’ action in your microflow? You could add the URL Redirector widget to the page.

If that won't work for you, I think you will have to approach this from the front, perhaps you can find a way to let a nanoflow handle it? The ‘openURL’ javascript action will open in the same tab.

 

answered