Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Intercept RPC request

    Hello,
    I am trying to renew user session , what i want to do is basically a way to intercept every RPC response that is being sent back by the server and reset a timer on my Smart GWT application.

    Basically the idea is to prompt the user about session expiry if he is idle on a page for 15 min providing him with option to renew his session.

    I cannot detect session expiry on client side and i donot want to keep polling the server to check if the session is active.

    Thanks,
    Sid

    #2
    Hi reachsidhu,

    have a look at the .ds.xml DataSource docs. Use the serverConstructor and you own subclass of IDACall and @Overrwite processRequest or handleDSRequest there.
    These are called for every server contact. You can reset you timer there.

    Best regards
    Blama

    Comment


      #3
      So , if i am understanding right . I have to write my own custom DS and have all of my DS implement this and create a server constructor on the custom DS and override the processrequest to do custom operations ?

      Comment


        #4
        Hi,

        sorry, I mixed two approaches.
        You could either do a SQLDataSource subclass and overwrite executeAdd, executeUpdate,.. and reference that from every .ds.xml.

        Or you could do a IDACall subclass and overwrite handleDSRequest or processRequest and reference that once from web.xml (most likely the better approach)

        All those override will finally call super.whatever().

        Best regards
        Blama

        Comment


          #5
          Hello,
          Thanks for the reply .. I am new to SmartGWT and still confused with the concept. If iam right Subclassing IDACall will be done on the server side. We use Spring MVC on server running on Tomcat. How do i get a handle of the timer on the client and reset it on the overrided methods ?

          Comment


            #6
            Hi reachsidhu,

            sorry again, you are right. I recognized "intercept RPC Request" because that is what I do, but I do it on the server (and for a different reason).
            You are right that for your use case you'll have to do it on the client. Unfortunately I did not do this before and after a quick look at RPCManager and DataSource I do not have an idea on how to do this.

            The only thing loosely related is this: DataSource.transformResponse() which explicitly mentions that this is not the place for changes involving the GUI (like your timer update).
            But I'm pretty sure it is possible to solve this. You'll have to wait for Isomorphic to answer.

            Interesting docs are: Quick Start Guide "Data Integration"-chapter and the 1st diagram in the "Overview"-chapter, where the "local operations" makes me think this is possible to solve.

            Best regards
            Blama

            Comment


              #7
              Regarding your Spring MVC approach, maybe the SmartGWT faq is also a good read for you. Take a look at the section named: "What MVC pattern should I use with Smart GWT: Struts, Spring, something else?"

              Comment


                #8
                Hi reachsidhu,

                regarding your initial question, how about this:
                • On the server: subclass IDACall, set 'timeout'-cookie with current time
                • On the client: GWT Timer, as suggested here (don't know if this is supported)
                • In the timed function: GWT Cookies plus update to your SmartGWT widget
                Best regards
                Blama

                Comment


                  #9
                  Hello everybody, what about do a filter on the server, as a controller of session id?. Each request will have this session id. And on the server to accept or reject the request, doing a forwarding to the login page.

                  Comment

                  Working...
                  X