Results 1 to 9 of 9

Thread: DWR problem after timeout with Spring Security

  1. #1
    Join Date
    Aug 2007
    Location
    Belgium
    Posts
    58

    Default DWR problem after timeout with Spring Security

    Hi guys,

    I ran into a little issue while using DWR in a Spring web application. We've set a session timeout for X minutes. After the session is expired, the user is automatically redirected to the login page. In case a DWR call is attempted after the session expiry, the user is also redirected to the login page (which is good). But after he tries to login in, Spring will go to the last url before the expiry. In case this was a DWR call, the user receives a download popup to try downloading this DWR script call.
    Is there a way to redirect back to the page where the DWR call is made instead of the call it self?

    Thanks in advance.
    Davy

  2. #2
    Join Date
    Aug 2007
    Location
    Belgium
    Posts
    58

    Default

    I found a solution for my problem described above. I replaced the redirect (after session expiry) from /login.htm to /logout.htm. In that way, Spring will clear everything from the session. This includes the URL of the last request after session expiry

  3. #3
    Join Date
    Jul 2007
    Posts
    8

    Default DWR call and session expired

    Hello,

    how can U achive that after session expiry in case a DWR call automatically redirected to the login page?

    Thanks
    Bye


    Quote Originally Posted by Krycek_A View Post
    Hi guys,

    I ran into a little issue while using DWR in a Spring web application. We've set a session timeout for X minutes. After the session is expired, the user is automatically redirected to the login page. In case a DWR call is attempted after the session expiry, the user is also redirected to the login page (which is good). But after he tries to login in, Spring will go to the last url before the expiry. In case this was a DWR call, the user receives a download popup to try downloading this DWR script call.
    Is there a way to redirect back to the page where the DWR call is made instead of the call it self?

    Thanks in advance.
    Davy

  4. #4
    Join Date
    Nov 2007
    Posts
    2

    Default

    Thanks Krycek_A for your hint.

    truszeka, please read "Coping with server session expiry" at directwebremoting.org web site ->Documentation ->Error Handling

    P.S. Since this is my first post a cannot post a url to this page.

  5. #5
    Join Date
    Jul 2007
    Posts
    8

    Default Thanks

    Thank You for your answer. But I've tried this "dwr.engine.setTextHtmlHandler" global function with no success. I use DWR 2.0.5.
    Maybe somthing other settings or things are incorrect.

    Bye, Bye

    Quote Originally Posted by CostasBal View Post
    Thanks Krycek_A for your hint.

    truszeka, please read "Coping with server session expiry" at directwebremoting.org web site ->Documentation ->Error Handling

    P.S. Since this is my first post a cannot post a url to this page.

  6. #6
    Join Date
    Nov 2007
    Posts
    2

    Default

    It seems to work fine for me. I use: DWR 2.0.5, Spring 2.5.3, Spring WebFlow 1.0.5, Tomcat 5.5.23 and Java 1.5.

  7. #7
    Join Date
    Jul 2007
    Posts
    8

    Default Bad news for me

    Quote Originally Posted by CostasBal View Post
    It seems to work fine for me. I use: DWR 2.0.5, Spring 2.5.3, Spring WebFlow 1.0.5, Tomcat 5.5.23 and Java 1.5.
    Hello,

    bad news for me, but I've tried all, no success. Now I implemented a JavaScript function witch count for the httpsession timeot time and after that redirect to the login page. This is all what I can do.
    Maybe can You give me some guidelines or tipps what to do ( or what not ).

    Bye, Bye

  8. #8
    Join Date
    Aug 2007
    Location
    Belgium
    Posts
    58

    Default

    Guys,

    Maybe this will sort some things out. Here is what I have done to solve my problem. In your page, add the following javascript code snippet in the head tag:

    Code:
    <script type="text/javascript">
         /*
          * Redirect to login page when a DWR request is send after a session timeout
          */
         try {
             if (dwr && dwr.engine) {
                 dwr.engine.setTextHtmlHandler(function() {
                     document.location = 'here goes the url to your login page';
                 });
             }
         catch(err) {} //ignore 
    </script>
    Make sure you also have the dwr libs on each page included

    If you make use of the SiteMesh decorator, you can place this code snippet in the decorator so you won't have to copy it on each page

  9. #9
    Join Date
    Jul 2007
    Posts
    8

    Default

    Thanks, but I have the same code (without dwr exists check)

    ;-(

    But thank You very much. Have You logged that your code is called? ( with Firebug log.console or whatother )

    Bye

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •