You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Pedro Calcao <pc...@opensoft.pt> on 2008/05/06 16:09:49 UTC

Trinidad 1.0.7 PPR after Timeout problem

Greetings,

I have recently upgraded an application from using Trinidad release 1.0.1 to
1.0.7.

Back in 1.0.1 I had to use a workaround for our TimeoutFilter to redirect
the user to the login page when a PPR request ocurred after the session had
timeout. Since that version still used iframes, it involved having a page
that tested to see if it was inside the iFrame, reset it's location, and
then redirect to the main login page, through
"location.href=myLoginPage.jsf".

Now that the PPR mechanism uses "true" AJAX, is there a way to redirect to a
page after a timeout has been detected?

If I try to do a simple redirect in the filter, I get the javascript errors:

["Invalid PPR response. The response-headers were:\nCache-Control:
no-cache="set-cookie"\nDate: Tue, 06 ..."]
["Error ", TypeError: a5 has no properties message=a5 has no properties, "
delivering XML request status changed to ", function(...

since the javascript handling the response is expecting a
<?Tr-XHR-Response-Type ?>, as far as I can tell.

Is there a standard mechanism to handle this situation, or any workaround
for sending a response that can be handled correctly by the PPR handling
mechanism and results in a redirect?

Thank you in advance,

Pedro


-- 
Os melhores cumprimentos,

Pedro Calção

Antwort: Re: Re: Trinidad 1.0.7 PPR after Timeout problem

Posted by wo...@pta.de.
Yes there is a JIRA issue filed some time ago also descirbing more details 
as to how Trinidad would need to be changed for that




"Pedro Calcao" <pc...@opensoft.pt> 
Gesendet von: calcao.pedro@gmail.com
06.05.2008 17:46
Bitte antworten an
"MyFaces Discussion" <us...@myfaces.apache.org>


An
"MyFaces Discussion" <us...@myfaces.apache.org>
Kopie

Thema
Re: Re: Trinidad 1.0.7 PPR after Timeout problem 






Hi again,

I think I understand what you propose, but I believe this solution doesn't 
work correctly in some situations, for exemple, when the session actually 
timed out in the time between two polls, and the user, for instance, tries 
to navigate to another page of a tr:table.

This can happen not just when the session expires, but, for instance, if 
the application happens to be redeployed on the server (not a very common 
scenario, but still likely in the early stages of an application being 
used in production environment).

I believe that there should be a generic way for the Trinidad 
infrastructure to handle a case like this, since handling session timeouts 
is a fairly simple case that should be transparent no matter if the 
request is a full page refresh, or a PPR.

Thank you for your responses so far :).

On Tue, May 6, 2008 at 4:02 PM, <wo...@pta.de> wrote:

Hi, 

E.g. you can use the polling component to navigate to the login screen 
after your session experied, 
 which you may calculate on the basis of the rsp. user's last access. and 
the current time. 

You can insert this code in the poller's listener method. 

        public void poll(PollEvent event) { //TODO insert here :) } 

Best wishes 
Wolfgang. 



"Pedro Calcao" <pc...@opensoft.pt> 
Gesendet von: calcao.pedro@gmail.com 
06.05.2008 16:45


Bitte antworten an
"MyFaces Discussion" <us...@myfaces.apache.org>


An
"MyFaces Discussion" <us...@myfaces.apache.org> 
Kopie

Thema
Re: Trinidad 1.0.7 PPR after Timeout problem 








Hi,

Thank you for the fast reply.

I might not have understood exactly your ideia, but wouldn't the polling 
serve only to keep the session active?


On Tue, May 6, 2008 at 3:39 PM, <wo...@pta.de> wrote: 

Hi, 

You might want to use the polling component of Trinidad. 

Best wishes 
Wolfgang 


"Pedro Calcao" <pc...@opensoft.pt> 
Gesendet von: calcao.pedro@gmail.com 
06.05.2008 16:09 



Bitte antworten an
"MyFaces Discussion" <us...@myfaces.apache.org>


An
"MyFaces Discussion" <us...@myfaces.apache.org> 
Kopie

Thema
Trinidad 1.0.7 PPR after Timeout problem 










Greetings,

I have recently upgraded an application from using Trinidad release 1.0.1 
to 1.0.7.

Back in 1.0.1 I had to use a workaround for our TimeoutFilter to redirect 
the user to the login page when a PPR request ocurred after the session 
had timeout. Since that version still used iframes, it involved having a 
page that tested to see if it was inside the iFrame, reset it's location, 
and then redirect to the main login page, through 
"location.href=myLoginPage.jsf".

Now that the PPR mechanism uses "true" AJAX, is there a way to redirect to 
a page after a timeout has been detected? 

If I try to do a simple redirect in the filter, I get the javascript 
errors:

["Invalid PPR response. The response-headers were:\nCache-Control: 
no-cache="set-cookie"\nDate: Tue, 06 ..."]
["Error ", TypeError: a5 has no properties message=a5 has no properties, " 
delivering XML request status changed to ", function(... 

since the javascript handling the response is expecting a 
<?Tr-XHR-Response-Type ?>, as far as I can tell.

Is there a standard mechanism to handle this situation, or any workaround 
for sending a response that can be handled correctly by the PPR handling 
mechanism and results in a redirect?

Thank you in advance,

Pedro


-- 
Os melhores cumprimentos,

Pedro Calção 



-- 
Os melhores cumprimentos,

Pedro Calção 



-- 
Os melhores cumprimentos,

Pedro Calção 

Re: Re: Trinidad 1.0.7 PPR after Timeout problem

Posted by Pedro Calcao <pc...@opensoft.pt>.
Hi again,

I think I understand what you propose, but I believe this solution doesn't
work correctly in some situations, for exemple, when the session actually
timed out in the time between two polls, and the user, for instance, tries
to navigate to another page of a tr:table.

This can happen not just when the session expires, but, for instance, if the
application happens to be redeployed on the server (not a very common
scenario, but still likely in the early stages of an application being used
in production environment).

I believe that there should be a generic way for the Trinidad infrastructure
to handle a case like this, since handling session timeouts is a fairly
simple case that should be transparent no matter if the request is a full
page refresh, or a PPR.

Thank you for your responses so far :).

On Tue, May 6, 2008 at 4:02 PM, <wo...@pta.de> wrote:

>
> Hi,
>
> E.g. you can use the polling component to navigate to the login screen
> after your session experied,
>  which you may calculate on the basis of the rsp. user's last access. and
> the current time.
>
> You can insert this code in the poller's listener method.
>
>         *public* *void* poll(PollEvent event) { //TODO insert here :) }
>
> Best wishes
> Wolfgang.
>
>
>
>  *"Pedro Calcao" <pc...@opensoft.pt>*
> Gesendet von: calcao.pedro@gmail.com
>
> 06.05.2008 16:45
>   Bitte antworten an
> "MyFaces Discussion" <us...@myfaces.apache.org>
>
>   An
> "MyFaces Discussion" <us...@myfaces.apache.org>
>  Kopie
>   Thema
> Re: Trinidad 1.0.7 PPR after Timeout problem
>
>
>
>
> Hi,
>
> Thank you for the fast reply.
>
> I might not have understood exactly your ideia, but wouldn't the polling
> serve only to keep the session active?
>
>
> On Tue, May 6, 2008 at 3:39 PM, <*w...@pta.de>>
> wrote:
>
> Hi,
>
> You might want to use the polling component of Trinidad.
>
> Best wishes
> Wolfgang
>
>
>   *"Pedro Calcao" <**pcalcao@opensoft.pt* <pc...@opensoft.pt>*>*
> Gesendet von: *calcao.pedro@gmail.com* <ca...@gmail.com>
>
> 06.05.2008 16:09
>
>
>   Bitte antworten an
> "MyFaces Discussion" <*u...@myfaces.apache.org>
> >
>
>   An
> "MyFaces Discussion" <*u...@myfaces.apache.org>
> >  Kopie
>   Thema
> Trinidad 1.0.7 PPR after Timeout problem
>
>
>
>
>
>
> Greetings,
>
> I have recently upgraded an application from using Trinidad release 1.0.1
> to *1.0.7.* <http://1.0.7/>
>
> Back in 1.0.1 I had to use a workaround for our TimeoutFilter to redirect
> the user to the login page when a PPR request ocurred after the session had
> timeout. Since that version still used iframes, it involved having a page
> that tested to see if it was inside the iFrame, reset it's location, and
> then redirect to the main login page, through
> "location.href=myLoginPage.jsf".
>
> Now that the PPR mechanism uses "true" AJAX, is there a way to redirect to
> a page after a timeout has been detected?
>
> If I try to do a simple redirect in the filter, I get the javascript
> errors:
>
> ["Invalid PPR response. The response-headers were:\nCache-Control:
> no-cache="set-cookie"\nDate: Tue, 06 ..."]
> ["Error ", TypeError: a5 has no properties message=a5 has no properties, "
> delivering XML request status changed to ", function(...
>
> since the javascript handling the response is expecting a
> <?Tr-XHR-Response-Type ?>, as far as I can tell.
>
> Is there a standard mechanism to handle this situation, or any workaround
> for sending a response that can be handled correctly by the PPR handling
> mechanism and results in a redirect?
>
> Thank you in advance,
>
> Pedro
>
>
> --
> Os melhores cumprimentos,
>
> Pedro Calção
>
>
>
> --
> Os melhores cumprimentos,
>
> Pedro Calção
>



-- 
Os melhores cumprimentos,

Pedro Calção

Antwort: Re: Trinidad 1.0.7 PPR after Timeout problem

Posted by wo...@pta.de.
Hi,

E.g. you can use the polling component to navigate to the login screen 
after your session experied,
 which you may calculate on the basis of the rsp. user's last access. and 
the current time.

You can insert this code in the poller's listener method.

        public void poll(PollEvent event) { //TODO insert here :) }

Best wishes
Wolfgang.




"Pedro Calcao" <pc...@opensoft.pt> 
Gesendet von: calcao.pedro@gmail.com
06.05.2008 16:45
Bitte antworten an
"MyFaces Discussion" <us...@myfaces.apache.org>


An
"MyFaces Discussion" <us...@myfaces.apache.org>
Kopie

Thema
Re: Trinidad 1.0.7 PPR after Timeout problem 






Hi,

Thank you for the fast reply.

I might not have understood exactly your ideia, but wouldn't the polling 
serve only to keep the session active?


On Tue, May 6, 2008 at 3:39 PM, <wo...@pta.de> wrote:

Hi, 

You might want to use the polling component of Trinidad. 

Best wishes 
Wolfgang 



"Pedro Calcao" <pc...@opensoft.pt> 
Gesendet von: calcao.pedro@gmail.com 
06.05.2008 16:09 


Bitte antworten an
"MyFaces Discussion" <us...@myfaces.apache.org>


An
"MyFaces Discussion" <us...@myfaces.apache.org> 
Kopie

Thema
Trinidad 1.0.7 PPR after Timeout problem 








Greetings,

I have recently upgraded an application from using Trinidad release 1.0.1 
to 1.0.7.

Back in 1.0.1 I had to use a workaround for our TimeoutFilter to redirect 
the user to the login page when a PPR request ocurred after the session 
had timeout. Since that version still used iframes, it involved having a 
page that tested to see if it was inside the iFrame, reset it's location, 
and then redirect to the main login page, through 
"location.href=myLoginPage.jsf".

Now that the PPR mechanism uses "true" AJAX, is there a way to redirect to 
a page after a timeout has been detected? 

If I try to do a simple redirect in the filter, I get the javascript 
errors:

["Invalid PPR response. The response-headers were:\nCache-Control: 
no-cache="set-cookie"\nDate: Tue, 06 ..."]
["Error ", TypeError: a5 has no properties message=a5 has no properties, " 
delivering XML request status changed to ", function(... 

since the javascript handling the response is expecting a 
<?Tr-XHR-Response-Type ?>, as far as I can tell.

Is there a standard mechanism to handle this situation, or any workaround 
for sending a response that can be handled correctly by the PPR handling 
mechanism and results in a redirect?

Thank you in advance,

Pedro


-- 
Os melhores cumprimentos,

Pedro Calção 



-- 
Os melhores cumprimentos,

Pedro Calção 

Re: Trinidad 1.0.7 PPR after Timeout problem

Posted by Pedro Calcao <pc...@opensoft.pt>.
Hi,

Thank you for the fast reply.

I might not have understood exactly your ideia, but wouldn't the polling
serve only to keep the session active?


On Tue, May 6, 2008 at 3:39 PM, <wo...@pta.de> wrote:

>
> Hi,
>
> You might want to use the polling component of Trinidad.
>
> Best wishes
> Wolfgang
>
>
>
>  *"Pedro Calcao" <pc...@opensoft.pt>*
> Gesendet von: calcao.pedro@gmail.com
>
> 06.05.2008 16:09
>  Bitte antworten an
> "MyFaces Discussion" <us...@myfaces.apache.org>
>
>   An
> "MyFaces Discussion" <us...@myfaces.apache.org>  Kopie
>   Thema
> Trinidad 1.0.7 PPR after Timeout problem
>
>
>
>
> Greetings,
>
> I have recently upgraded an application from using Trinidad release 1.0.1
> to *1.0.7.* <http://1.0.7/>
>
> Back in 1.0.1 I had to use a workaround for our TimeoutFilter to redirect
> the user to the login page when a PPR request ocurred after the session had
> timeout. Since that version still used iframes, it involved having a page
> that tested to see if it was inside the iFrame, reset it's location, and
> then redirect to the main login page, through
> "location.href=myLoginPage.jsf".
>
> Now that the PPR mechanism uses "true" AJAX, is there a way to redirect to
> a page after a timeout has been detected?
>
> If I try to do a simple redirect in the filter, I get the javascript
> errors:
>
> ["Invalid PPR response. The response-headers were:\nCache-Control:
> no-cache="set-cookie"\nDate: Tue, 06 ..."]
> ["Error ", TypeError: a5 has no properties message=a5 has no properties, "
> delivering XML request status changed to ", function(...
>
> since the javascript handling the response is expecting a
> <?Tr-XHR-Response-Type ?>, as far as I can tell.
>
> Is there a standard mechanism to handle this situation, or any workaround
> for sending a response that can be handled correctly by the PPR handling
> mechanism and results in a redirect?
>
> Thank you in advance,
>
> Pedro
>
>
> --
> Os melhores cumprimentos,
>
> Pedro Calção
>



-- 
Os melhores cumprimentos,

Pedro Calção

Antwort: Trinidad 1.0.7 PPR after Timeout problem

Posted by wo...@pta.de.
Hi,

You might want to use the polling component of Trinidad.

Best wishes
Wolfgang




"Pedro Calcao" <pc...@opensoft.pt> 
Gesendet von: calcao.pedro@gmail.com
06.05.2008 16:09
Bitte antworten an
"MyFaces Discussion" <us...@myfaces.apache.org>


An
"MyFaces Discussion" <us...@myfaces.apache.org>
Kopie

Thema
Trinidad 1.0.7 PPR after Timeout problem 






Greetings,

I have recently upgraded an application from using Trinidad release 1.0.1 
to 1.0.7.

Back in 1.0.1 I had to use a workaround for our TimeoutFilter to redirect 
the user to the login page when a PPR request ocurred after the session 
had timeout. Since that version still used iframes, it involved having a 
page that tested to see if it was inside the iFrame, reset it's location, 
and then redirect to the main login page, through 
"location.href=myLoginPage.jsf".

Now that the PPR mechanism uses "true" AJAX, is there a way to redirect to 
a page after a timeout has been detected? 

If I try to do a simple redirect in the filter, I get the javascript 
errors:

["Invalid PPR response. The response-headers were:\nCache-Control: 
no-cache="set-cookie"\nDate: Tue, 06 ..."]
["Error ", TypeError: a5 has no properties message=a5 has no properties, " 
delivering XML request status changed to ", function(...

since the javascript handling the response is expecting a 
<?Tr-XHR-Response-Type ?>, as far as I can tell.

Is there a standard mechanism to handle this situation, or any workaround 
for sending a response that can be handled correctly by the PPR handling 
mechanism and results in a redirect?

Thank you in advance,

Pedro


-- 
Os melhores cumprimentos,

Pedro Calção