Java Action will not work before login

0
We have a Java Action to return the type of browser so that we can then determine how to display a PDF (use PDFjs or not). The java action works fine once the user is logged into the App, but we also have a button on the login screen that the user can click to see a PDF discussing issues they may have logging in (e.g. who to contact if having issues etc.) When the Java Action is called from the login screen it fails to detect the Browser. We have given the anonymous user access to every entity / page / microflow involved. Can anyone advise? Many Thanks, Simon. Error returned   Java Action Code package administration.actions; import net.sf.uadetector.ReadableUserAgent; import net.sf.uadetector.UserAgentStringParser; import net.sf.uadetector.service.UADetectorServiceFactory; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.systemwideinterfaces.core.ISession; import com.mendix.webui.CustomJavaAction; import com.mendix.systemwideinterfaces.core.IMendixObject; /**  * This Java action returns info about the web browser  */ public class GetBrowserInfo extends CustomJavaAction<String> {     public GetBrowserInfo(IContext context)     {         super(context);     }     @Override     public String executeAction() throws Exception     {         // BEGIN USER CODE         UserAgentStringParser parser = UADetectorServiceFactory.getResourceModuleParser();         ReadableUserAgent agent = parser.parse(getContext().getSession().getUserAgent());         return agent.getName();         // END USER CODE     }     /**      * Returns a string representation of this action      */     @Override     public String toString()     {         return "GetBrowserInfo";     }     // BEGIN EXTRA CODE     // END EXTRA CODE }
asked
1 answers
1

Hey Simon. I've disappointing news. I've tested your Java action in Mendix 5.20.0 as an anonymous user and as logged in user. The Mendix function 'getContext().getSession().getUserAgent()' doesn't return the browser info when it's an anonymous user. In Mendix 6.6.0 doesn't work either.

I advice you to report an issue at Mendix support: support.mendix.com.

answered