You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Athneria, Mahendra" <ma...@atos.net> on 2012/03/29 10:15:49 UTC

when return streamResponse, Ajax stop working in tapestry5

Hi Guys,

I have a page with one Ajax link and one actionLink. ActionLink is to generate the report. When I click on ActionLink, it will generate the report (it returns the streamResponse object) but after that ajax link stop work. But when I refresh the page then again Ajax link start working.

Is there any issue of Ajax and StreamResponse or problem is something else?

Below is the code of JS
*******************************************
    switchState: function(e) {
      // Call server-side update URL
      Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this));
    },

    switchSuccess: function(e){
      this.showHide(e);
    },
***************************************

In above code - before generating report  "Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this))" function able to call the switchSuccess method. But once I generate the report "Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this))" function will not be able to call the switchSuccess method.

Regards,
Mahendra Athneria
[cid:221044411@01072011-28AB]
Ext-+91 22 6733 3729
Mob-+91 9833 121 309
mahendra.athneria@atos.net
[cid:image001.gif@01CA57B6.7335F1E0]



This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.

RE: when return streamResponse, Ajax stop working in tapestry5

Posted by "Athneria, Mahendra" <ma...@atos.net>.
Hi Bryan,

Thanks a lot for your help.

Regards,
Mahendra Athneria

Ext-+91 22 6733 3729
Mob-+91 9833 121 309
mahendra.athneria@atos.net


-----Original Message-----
From: Bryan Lewis [mailto:jbryanlewis@gmail.com] 
Sent: Thursday, March 29, 2012 5:23 PM
To: Tapestry users
Subject: Re: when return streamResponse, Ajax stop working in tapestry5

We had the same problem.  After a StreamResponse, an Ajax link on the same
page stopped working.  Where "stopped working" means, the link did invoke a
server-side method, but no results appeared in the browser.

A few work-arounds were discussed in this list (search for
"windowunloaded"), such as target=_blank or an iframe.  I had some luck by
adding a Refresh response header to my StreamResponse.  But the proper fix
is in the Jira issue TAP5-1533, fixed in Tap 5.3.  (I'm assuming you're on
Tap 5.2.x as I am.)  If you can't upgrade yet, you could apply the patch,
one line of javascript to tapestry.js in the tapestry-core jar.  Worked for
me.



On Thu, Mar 29, 2012 at 4:15 AM, Athneria, Mahendra <
mahendra.athneria@atos.net> wrote:

>  Hi Guys,****
>
> ** **
>
> I have a page with one Ajax link and one actionLink. ActionLink is to
> generate the report. When I click on ActionLink, it will generate the
> report (it returns the streamResponse object) but after that ajax link stop
> work. But when I refresh the page then again Ajax link start working.****
>
> ** **
>
> Is there any issue of Ajax and StreamResponse or problem is something else?
> ****
>
> ** **
>
> Below is the code of JS****
>
> ***********************************************
>
>     switchState: *function*(e) {****
>
>       // Call server-side update URL****
>
>       Tapestry.ajaxRequest(*this*.switchUrl, *this*.switchSuccess.bind(*
> this*));****
>
>     },****
>
>     ****
>
>     switchSuccess: *function*(e){****
>
>       *this*.showHide(e);****
>
>     },****
>
> *******************************************
>
> ** **
>
> In above code - before generating report  "Tapestry.ajaxRequest(*this*.
> switchUrl, *this*.switchSuccess.bind(*this*))" function able to call the
> switchSuccess method. But once I generate the report "
> Tapestry.ajaxRequest(*this*.switchUrl, *this*.switchSuccess.bind(*this*))"
> function will not be able to call the switchSuccess method.****
>
> ** **
>
> *Regards,*
>
> *Mahendra Athneria*
>
> [image: cid:221044411@01072011-28AB]**
>
> Ext-+91 22 6733 3729****
>
> Mob-+91 9833 121 309****
>
> *mahendra.athneria@atos.net*
>
> [image: cid:image001.gif@01CA57B6.7335F1E0]****
>
> ** **
>  ------------------------------
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Atos group liability
> cannot be triggered for the message content. Although the sender endeavors
> to maintain a computer virus-free network, the sender does not warrant that
> this transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.
> ------------------------------
>


This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: when return streamResponse, Ajax stop working in tapestry5

Posted by Bryan Lewis <jb...@gmail.com>.
We had the same problem.  After a StreamResponse, an Ajax link on the same
page stopped working.  Where "stopped working" means, the link did invoke a
server-side method, but no results appeared in the browser.

A few work-arounds were discussed in this list (search for
"windowunloaded"), such as target=_blank or an iframe.  I had some luck by
adding a Refresh response header to my StreamResponse.  But the proper fix
is in the Jira issue TAP5-1533, fixed in Tap 5.3.  (I'm assuming you're on
Tap 5.2.x as I am.)  If you can't upgrade yet, you could apply the patch,
one line of javascript to tapestry.js in the tapestry-core jar.  Worked for
me.



On Thu, Mar 29, 2012 at 4:15 AM, Athneria, Mahendra <
mahendra.athneria@atos.net> wrote:

>  Hi Guys,****
>
> ** **
>
> I have a page with one Ajax link and one actionLink. ActionLink is to
> generate the report. When I click on ActionLink, it will generate the
> report (it returns the streamResponse object) but after that ajax link stop
> work. But when I refresh the page then again Ajax link start working.****
>
> ** **
>
> Is there any issue of Ajax and StreamResponse or problem is something else?
> ****
>
> ** **
>
> Below is the code of JS****
>
> ***********************************************
>
>     switchState: *function*(e) {****
>
>       // Call server-side update URL****
>
>       Tapestry.ajaxRequest(*this*.switchUrl, *this*.switchSuccess.bind(*
> this*));****
>
>     },****
>
>     ****
>
>     switchSuccess: *function*(e){****
>
>       *this*.showHide(e);****
>
>     },****
>
> *******************************************
>
> ** **
>
> In above code - before generating report  “Tapestry.ajaxRequest(*this*.
> switchUrl, *this*.switchSuccess.bind(*this*))” function able to call the
> switchSuccess method. But once I generate the report “
> Tapestry.ajaxRequest(*this*.switchUrl, *this*.switchSuccess.bind(*this*))”
> function will not be able to call the switchSuccess method.****
>
> ** **
>
> *Regards,*
>
> *Mahendra Athneria*
>
> [image: cid:221044411@01072011-28AB]**
>
> Ext-+91 22 6733 3729****
>
> Mob-+91 9833 121 309****
>
> *mahendra.athneria@atos.net*
>
> [image: cid:image001.gif@01CA57B6.7335F1E0]****
>
> ** **
>  ------------------------------
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Atos group liability
> cannot be triggered for the message content. Although the sender endeavors
> to maintain a computer virus-free network, the sender does not warrant that
> this transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.
> ------------------------------
>

RE: when return streamResponse, Ajax stop working in tapestry5

Posted by "Athneria, Mahendra" <ma...@atos.net>.
Hi Lance,

I am not using Zone for streamResponse data

Regards,
Mahendra Athneria

Ext-+91 22 6733 3729
Mob-+91 9833 121 309
mahendra.athneria@atos.net


-----Original Message-----
From: Lance Java [mailto:lance.java@googlemail.com] 
Sent: Thursday, March 29, 2012 2:56 PM
To: Tapestry users
Subject: Re: when return streamResponse, Ajax stop working in tapestry5

Tapestry expects the response from an ajax event method to be a json
string, not a stream of data. To use a StreamResponse you should not
specify a zone.

On Thursday, 29 March 2012, Athneria, Mahendra <ma...@atos.net>
wrote:
> Hi Guys,
>
>
>
> I have a page with one Ajax link and one actionLink. ActionLink is to
generate the report. When I click on ActionLink, it will generate the
report (it returns the streamResponse object) but after that ajax link stop
work. But when I refresh the page then again Ajax link start working.
>
>
>
> Is there any issue of Ajax and StreamResponse or problem is something
else?
>
>
>
> Below is the code of JS
>
> *******************************************
>
>     switchState: function(e) {
>
>       // Call server-side update URL
>
>       Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this));
>
>     },
>
>
>
>     switchSuccess: function(e){
>
>       this.showHide(e);
>
>     },
>
> ***************************************
>
>
>
> In above code - before generating report
"Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this))"
function able to call the switchSuccess method. But once I generate the
report "Tapestry.ajaxRequest(this.switchUrl,
this.switchSuccess.bind(this))" function will not be able to call the
switchSuccess method.
>
>
>
> Regards,
>
> Mahendra Athneria
>
> Ext-+91 22 6733 3729
>
> Mob-+91 9833 121 309
>
> mahendra.athneria@atos.net
>
>
>
> ________________________________
> This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive this
e-mail in error, please notify the sender immediately and destroy it. As
its integrity cannot be secured on the Internet, the Atos group liability
cannot be triggered for the message content. Although the sender endeavors
to maintain a computer virus-free network, the sender does not warrant that
this transmission is virus-free and will not be liable for any damages
resulting from any virus transmitted.
> ________________________________


This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: when return streamResponse, Ajax stop working in tapestry5

Posted by Denis Stepanov <de...@gmail.com>.
On your ActionLink.

<t:actionLink ref="external" ...

Denis

Mar 29, 2012 v 1:25 PM, Athneria, Mahendra:

> Thanks Denis,
> 
> Could please tell me where I can add ref="external" in my code?
> 
> Regards,
> Mahendra Athneria
> 
> 
> -----Original Message-----
> From: Denis Stepanov [mailto:denis.stepanov@gmail.com] 
> Sent: Thursday, March 29, 2012 4:36 PM
> To: Tapestry users
> Subject: Re: when return streamResponse, Ajax stop working in tapestry5
> 
> Try to add ref="external", it has something to do with tapestry.js and unloading.
> 
> Denis
> 
> Mar 29, 2012 v 11:57 AM, Lance Java:
> 
>> I just re-read your entire message (nabble messed up your code) and realise
>> that I have answered an unrelated question.
>> 
>> Sorry
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> 
> This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: when return streamResponse, Ajax stop working in tapestry5

Posted by "Athneria, Mahendra" <ma...@atos.net>.
Thanks Denis,

Could please tell me where I can add ref="external" in my code?

Regards,
Mahendra Athneria


-----Original Message-----
From: Denis Stepanov [mailto:denis.stepanov@gmail.com] 
Sent: Thursday, March 29, 2012 4:36 PM
To: Tapestry users
Subject: Re: when return streamResponse, Ajax stop working in tapestry5

Try to add ref="external", it has something to do with tapestry.js and unloading.

Denis

Mar 29, 2012 v 11:57 AM, Lance Java:

> I just re-read your entire message (nabble messed up your code) and realise
> that I have answered an unrelated question.
> 
> Sorry


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org




This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: when return streamResponse, Ajax stop working in tapestry5

Posted by Denis Stepanov <de...@gmail.com>.
Try to add ref="external", it has something to do with tapestry.js and unloading.

Denis

Mar 29, 2012 v 11:57 AM, Lance Java:

> I just re-read your entire message (nabble messed up your code) and realise
> that I have answered an unrelated question.
> 
> Sorry


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: when return streamResponse, Ajax stop working in tapestry5

Posted by Lance Java <la...@googlemail.com>.
I just re-read your entire message (nabble messed up your code) and realise
that I have answered an unrelated question.

Sorry

Re: when return streamResponse, Ajax stop working in tapestry5

Posted by Lance Java <la...@googlemail.com>.
Tapestry expects the response from an ajax event method to be a json
string, not a stream of data. To use a StreamResponse you should not
specify a zone.

On Thursday, 29 March 2012, Athneria, Mahendra <ma...@atos.net>
wrote:
> Hi Guys,
>
>
>
> I have a page with one Ajax link and one actionLink. ActionLink is to
generate the report. When I click on ActionLink, it will generate the
report (it returns the streamResponse object) but after that ajax link stop
work. But when I refresh the page then again Ajax link start working.
>
>
>
> Is there any issue of Ajax and StreamResponse or problem is something
else?
>
>
>
> Below is the code of JS
>
> *******************************************
>
>     switchState: function(e) {
>
>       // Call server-side update URL
>
>       Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this));
>
>     },
>
>
>
>     switchSuccess: function(e){
>
>       this.showHide(e);
>
>     },
>
> ***************************************
>
>
>
> In above code - before generating report
“Tapestry.ajaxRequest(this.switchUrl, this.switchSuccess.bind(this))”
function able to call the switchSuccess method. But once I generate the
report “Tapestry.ajaxRequest(this.switchUrl,
this.switchSuccess.bind(this))” function will not be able to call the
switchSuccess method.
>
>
>
> Regards,
>
> Mahendra Athneria
>
> Ext-+91 22 6733 3729
>
> Mob-+91 9833 121 309
>
> mahendra.athneria@atos.net
>
>
>
> ________________________________
> This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive this
e-mail in error, please notify the sender immediately and destroy it. As
its integrity cannot be secured on the Internet, the Atos group liability
cannot be triggered for the message content. Although the sender endeavors
to maintain a computer virus-free network, the sender does not warrant that
this transmission is virus-free and will not be liable for any damages
resulting from any virus transmitted.
> ________________________________