Class RequestHandler


  • public abstract class RequestHandler
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestHandler()  
      RequestHandler​(java.lang.Object component)
      Deprecated.
      As of Mendix 8.11.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String buildUserInfo​(IContext context)  
      void doProcessRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request, com.mendix.m2ee.api.IMxRuntimeResponse response, java.lang.String path)  
      protected java.lang.String formatDate​(java.util.Date date)  
      protected long getExpiresTimeStamp​(int addYears)  
      protected java.lang.String getSessionCookieName()  
      protected ISession getSessionFromRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request)
      Get the session using the cookie.
      protected ISession getSessionFromRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request, boolean performCSRFCheck)
      Get the session using the cookie.
      protected boolean isSessionKilledByNewLogin​(com.mendix.m2ee.api.IMxRuntimeRequest request)
      Returns whether the specified session has expired.
      protected java.util.Date parseDate​(java.lang.String date)  
      protected abstract void processRequest​(com.mendix.m2ee.api.IMxRuntimeRequest request, com.mendix.m2ee.api.IMxRuntimeResponse response, java.lang.String path)
      Process the request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CSRF_TOKEN_HEADER

        public static final java.lang.String CSRF_TOKEN_HEADER
        See Also:
        Constant Field Values
      • CSRF_TOKEN_PARAMETER

        public static final java.lang.String CSRF_TOKEN_PARAMETER
        See Also:
        Constant Field Values
      • APPLICATION_OCTET_STREAM_TYPE

        protected static final java.lang.String APPLICATION_OCTET_STREAM_TYPE
        See Also:
        Constant Field Values
      • logger

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

      • RequestHandler

        public RequestHandler()
      • RequestHandler

        @Deprecated
        public RequestHandler​(java.lang.Object component)
        Deprecated.
        As of Mendix 8.11. Use the no-arg constructor.
        Construct 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
        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()