Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82426

Java Action will not work before login

$
0
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
}


Viewing all articles
Browse latest Browse all 82426

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>