Class RequestHandler

  • All Implemented Interfaces:
    IRequestHandler

    public abstract class RequestHandler
    extends java.lang.Object
    implements IRequestHandler
    Implementation of IRequestHandler that provides some access to the Mendix Runtime. Most importantly, it lets you access session information of requests.
    • Field Detail

      • logger

        protected com.mendix.logging.ILogNode logger
    • Constructor Detail

      • RequestHandler

        public RequestHandler()
    • Method Detail

      • doProcessRequest

        public void doProcessRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request,
                                     com.mendix.m2ee.api.IMxRuntimeResponse response,
                                     java.lang.String path)
                              throws java.lang.Exception
        Specified by:
        doProcessRequest in interface IRequestHandler
        Throws:
        java.lang.Exception
      • processRequest

        protected abstract void processRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request,
                                               com.mendix.m2ee.api.IMxRuntimeResponse response,
                                               java.lang.String path)
                                        throws java.lang.Exception
        Process the request.
        Throws:
        java.lang.Exception
      • getSessionFromRequest

        protected ISession getSessionFromRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request)
                                          throws CoreException
        Get the session using the cookie. No csrf check will be performed.
        Parameters:
        request - the request from which to get the session
        Returns:
        the session
        Throws:
        CoreException - if the session cannot be retrieved
      • getSessionFromRequest

        protected ISession getSessionFromRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request,
                                                 boolean performCSRFCheck)
                                          throws CoreException
        Get the session using the cookie.
        Parameters:
        request - the request from which to get the session
        performCSRFCheck - whether a csrf check will be performed using the request headers
        Returns:
        the session
        Throws:
        CoreException - if the session cannot be retrieved
      • isSessionKilledByNewLogin

        protected boolean isSessionKilledByNewLogin​(com.mendix.m2ee.api.IMxRuntimeRequest request)
        Returns whether the specified session has expired.
        Parameters:
        request - the request from which to get the session
        Returns:
        true if the session expired, false otherwise
      • buildUserInfo

        protected java.lang.String buildUserInfo​(IContext context)
      • getExpiresTimeStamp

        protected long getExpiresTimeStamp​(int addYears)
      • formatDate

        protected java.lang.String formatDate​(java.util.Date date)
      • parseDate

        protected java.util.Date parseDate​(java.lang.String date)
                                    throws java.text.ParseException
        Throws:
        java.text.ParseException
      • getSessionCookieName

        protected java.lang.String getSessionCookieName()