psdi.webclient.system.session

Class AsyncRequestManager

  • java.lang.Object
    • psdi.webclient.system.session.AsyncRequestManager


  • public class AsyncRequestManager
    extends java.lang.Object
    The class used by the Tpae UI framework to manage HttpServletRequest asynchronously
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String DUP_SEQ_NUM 
      static java.lang.String PAGE_SEQ_NUM 
      static java.lang.String XHR_SEQ_NUM 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      long getLastRequestSeqNumHandled() 
      long getNextPageRenderSeqNumber()
      THIS METHOD SHOULD ONLY BE CALLED BY the PageInstance render method when the page is performing a complete render (or rerender) of the main application page.
      void manageRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Looks at the passed in request, determines if it's a synchronous or high/low priority asynchronous request by looking at the requesttype parameter.
      void resetRequestSequenceNumber()
      Resets the xhr request sequence number back to 1 so the next request to be handled by this this class should have the xhr-seq-num header value of 1.
      • Methods inherited from class java.lang.Object

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

      • manageRequest

        public void manageRequest(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws javax.servlet.ServletException,
                                  java.io.IOException
        Looks at the passed in request, determines if it's a synchronous or high/low priority asynchronous request by looking at the requesttype parameter.

        The four request types are:

        sync - The request is synchronous and no other requests (for that particular WebClientSession) will be permitted until the complete request is handled. Basically the request works as it does today. This type is also the default so it the parameter doesn't exist or is blank the request will be treated as synchronous .
        async - The request is a normal (or low priority) asynchronous request that will allow other requests to be "queued". There will be a configurable "delayed page render" after so many queued requests have been handled. There will also be a configurable time limit that will allow the page render if a render hasn't been sent within the specified time.
        highasync - A high priority (hp) request that will be handled before all other low/normal priority requests that are queued. There will be a queue of hp requests and they will be handled FIFO order. Hp requests will be sent directly to a component or control and expects the component/control to render the response itself within the call to the component/control. There will not be a complete ui render.
        norender - A low priority request that will be handled directly by the component/control but no UI render will be called. Basically work the same as the highasync but a low priority and no response data is expected.

        If the requesttype parameter is null, deoesn't have a value or one of the types listed above the request will be considered a synchronous event.
        Parameters:
        request - HttpServletRequest object sent to the Tpae UI framework (via the WebClientServlet) from the client (browser).
        response - HttpServletResponse object that contains the response the Tpae UI framework returns to the client
        Throws:
        java.io.IOException - passing the IOException thrown from the eventual call to handleRequest on WebClientSession. Expecting the calling routine to handle the exception.
        javax.servlet.ServletException - passing the ServletException thrown from the eventual call to handleRequest on WebClientSession. Expecting the calling routine to handle the exception.
      • resetRequestSequenceNumber

        public void resetRequestSequenceNumber()
        Resets the xhr request sequence number back to 1 so the next request to be handled by this this class should have the xhr-seq-num header value of 1.
      • getNextPageRenderSeqNumber

        public long getNextPageRenderSeqNumber()
        THIS METHOD SHOULD ONLY BE CALLED BY the PageInstance render method when the page is performing a complete render (or rerender) of the main application page. This method returns the value for the render-seq-num request header placed byt he XHR requests sent by the client (browser). This sequence number is used by the framework are maintain proper order of requests sent by the browser. Every time this method is called the sequence number is incremented by one. To obtain what the current sequence number is, call getCurrentPageRenderSeqNumber().
        Returns:
        The next render sequence number to be used by the main application page.
      • getLastRequestSeqNumHandled

        public long getLastRequestSeqNumHandled()
        Returns:
        the lastRequestSeqNumHandled