Yes. I'm sure it has session. It is not a trivial application, we used
session everywhere. And I used your way to confirm it too. The value is
true.

Here is the js part from generated html. 

tapestry.TimeoutTimerConfirm=function(){};
    tapestry.TimeoutProlongSessionTime=function(){};
    tapestry.TimeoutExpirationTime=function(){};
    
    
    tapestry.TimeoutConfirm=function()
    {
        tapestry.TimeoutClearConfirmTimer();
    
        var exp = new Date();
        exp.setTime(exp.getTime() + 660000);
            var hrs = exp.getHours();
        var min = exp.getMinutes();
        if (min < 10)
            mins = "0" + min;
        else
            mins = min;
    
        var confirmMessage = "The connection was inactive for more than {0}
minutes. Your session will expire at {1}.\n Please click OK to continue your
work or CANCEL to close the session.";
        confirmMessage = confirmMessage.replace("{0}", Math.round(0/60000));
        confirmMessage = confirmMessage.replace("{1}", hrs + ":" + mins);

        var val = confirm(confirmMessage);
        if (!val) {
                    
                return;
        }
       
        var current = new Date();
        if (current.getTime() > exp.getTime()) {
            alert("Your session has expired. Please log in again.");
                    
        }
        else {
                tapestry.TimeoutProlongSession();
        }
    }
    
    tapestry.TimeoutProlongSession=function()
    {
            tapestry.TimeoutUpdateProlongSessionTime();
                TimeoutRenewSession();
    }
    
    TimeoutSessionRenewed=function()
    {
        tapestry.TimeoutClearConfirmTimer();
        tapestry.TimeoutInitConfirmTimer();
    }
    
    tapestry.TimeoutClearConfirmTimer=function()
    {
        window.clearTimeout(tapestry.TimeoutTimerConfirm);
    }
    
    tapestry.TimeoutInitConfirmTimer=function()
    {
            
        tapestry.TimeoutTimerConfirm = window.setTimeout("TimeoutConfirm()",
0);
        

        tapestry.TimeoutExpirationTime = new Date();
 
tapestry.TimeoutExpirationTime.setTime(tapestry.TimeoutExpirationTime.getTim
e() + 0 + 660000);

                tapestry.TimeoutUpdateProlongSessionTime();
    }
    
    tapestry.TimeoutUpdateProlongSessionTime=function()
    {
        tapestry.TimeoutProlongSessionTime = new Date();
 
tapestry.TimeoutProlongSessionTime.setTime(tapestry.TimeoutProlongSessionTim
e.getTime() + -240000);
    }

    
    
    tapestry.TimeoutInitConfirmTimer();
function TimeoutRenewSession() 
        {
                var requestObject = getRequest();
                if (!requestObject) {
                        
                        return;
                }
                
            var url =
"/dboard/xtile.svc?component=%24Border.%24Timeout.%24XTile&page=Boards";
            var arguments = TimeoutRenewSession.arguments;
            var argumentCount = arguments.length;
            for (i = 0; i < argumentCount; i++) {
                url = url + "&sp=" + encodeURI(arguments[i]);
            }
            
            
            url = url + "&rand=" + Math.random();
            
        
                requestObject.onreadystatechange = function() {
                        if (requestObject.readyState == 4) {
                                if (requestObject.status == 200) {
                                        var data =
extractData(requestObject);
                                        TimeoutSessionRenewed(data);
                                }
                                
                        }
                }
                
            requestObject.open("GET", url, true);
            requestObject.send(null);
        }
        

-----Original Message-----
From: Hugo Palma [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 17, 2007 11:29 AM
To: Tapestry users
Subject: Re: contrib:Timeout

Are you sure ur application is creating a session ?
Add this to ur page class:

@InjectObject("infrastructure:request")
    public abstract WebRequest getRequest();

    public boolean isInSession() {
        return getRequest().getSession(false) != null;
    }

and print out the value of the inSession property. Does it confirm that 
u r in a session ?

Henry Chen wrote:
> For some reason, when I post from Nable the code parts were lost. I'm
> reposting from outlook this time.
>
> Thank you for helping.
>
> Sorry I didn't realize that the code is missing from my original post. 
> Here it is:
>
> <span jwcid="@contrib:Timeout" warningTime="100"
disableAutoProlong="true"/>
>
> There is no js error. I read the generated js code and it looks like
> warningTime should be in millisecond. So I tried the following which
didn't
> work either.
>
> <span jwcid="@contrib:Timeout" warningTime="60000"
> disableAutoProlong="true"/>
>
>
> -----Original Message-----
> From: Henry Chen [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 17, 2007 10:27 AM
> To: users@tapestry.apache.org
> Subject: Re: contrib:Timeout
>
>
> Thank you for helping.
>
> Sorry I didn't realize that the code is missing from my original post. 
> Here it is:
>
>
>
> There is no js error. I read the generated js code and it looks like
> warningTime should be in millisecond. So I tried the following which
didn't
> work either.
>
>
>
>
>
>
> HugoPalma wrote:
>   
>> Did the session actually expire after the 10 minutes wait ?
>> What parameters did u provide to the TimeoutComponent and what are their 
>> values ?
>> Did u check for javascript errors on the page ?
>>
>> Henry Chen wrote:
>>     
>>> Nobody had the similar experience? Can anybody help? Thank you very much
>>> in
>>> advance.
>>>
>>>
>>> Henry Chen wrote:
>>>   
>>>       
>>>> I'm using the latest Tap4.1.2.
>>>>
>>>> Did anybody successfully use contrib:Timeout?
>>>> I tried to use it in the my border component as below.
>>>>
>>>>
>>>>
>>>> I set the session time in web.xml to 10 mins and waited but nothing
>>>> happened. I found some "timeout" related js code are added. Why didn't
>>>> it
>>>> work? Please help. Thank you.
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to