You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Magnus Rundberget <ru...@me.com> on 2009/09/08 10:14:44 UTC

streamresponse actionlink and zone problem

Hi,

I have a page with a left hand listing of reports and a righthand zone  
showing details for the reports when clicking reportlinks in the  
listing. In the zone I have an actionlink for downloading a pdf  
version of the report.

When clicking the links in the listing the zone updates correctly. But  
as soon as I click and download a pdf, the report-links on the  
lefthand side seizes to work. To get them working again I have to  
refresh the page.

Using firebug I can see that the actionlink posts and receives the  
correct response, but the zone is never updated. Tried debugging the  
Tapestry Javascript but can't figure out where exactly it fails.
(It does enter ZoneManager.updateFromURL, but never invokes  
ZoneManager.processReply)


I've used the following wiki page as inspiration for returing the pdf:
http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile


anyone got any ideas ?

regards
Magnus

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


Re: streamresponse actionlink and zone problem

Posted by Magnus Rundberget <ru...@me.com>.
Cheers,

tried a little more to figure it out. Made a dead simple page, but the  
same problem.
So I just rewrote the actionlink to a pagelink to a new page using  
target="_blank". That works, but flickers a little.
The new download page returns the streamresponse in onActivate.

thx
Magnus


On 8. sep.. 2009, at 11.37, Joost Schouten (ml) wrote:

> I think your pdf download will be upsetting your page state in some  
> way. I generally choose to make a separate page to handle downloads.  
> Otherwise isolation seems the way forward I would say and focus on  
> the debuging javascript and the errors you might get there.
>
> Magnus Rundberget wrote:
>> Cheers,
>>
>> Thx for swift reply.
>>
>> - Not using zone param in the actionlink for downloading the pdf  
>> though.
>>
>> I can't post the complete code (as its a whole lot going on :-)
>>
>>
>> The page has the following layout;
>> - Left column; Listing reports. Each report represented by an  
>> actionlink with zone param="reportDetails" (<t:actionlink  
>> t:id="selectReport" context="report.id" zone="reportDetails">$ 
>> {report.name}</t:actionlink>)
>> - Right column: Showing details about a report. The details are  
>> wrapped in a zone "reportDetails". Inside the zone is an actionlink  
>> to download a pdf (<t:actionlink t:id="downloadPdf">${message:report-downloadPdf 
>> }</t:actionlink>)
>>
>>
>> the page class has the following code for the actionlinks mentioned  
>> above;
>>
>> // download pdf
>> StreamResponse onActionFromDownloadPdf() {
>>       /* this code basically constructs a pdf and returns a  
>> StreamResponse, as described in http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile 
>>  */
>>     return new PDFTransformer().generatePDF(report);
>>    }
>>
>> // actionlink for returning reportDetails Zone
>> Object onActionFromSelectReport(int id) {
>>        Report report = reportRepository.findById(id);
>>        return reportDetails.getBody();
>>    }
>>
>>
>> not much magic in this. Obviously since the page has lots of other  
>> stuff, this could be the cause,
>> I might have to make a simpler page to isolate the problem, but was  
>> hoping that maybe someone else has stumbled upon a similar  
>> scenario...
>>
>> kind regards
>> Magnus
>>
>>
>>
>>
>>
>>
>>
>>
>> On 8. sep.. 2009, at 10.51, Joost Schouten (ml) wrote:
>>
>>> Hi Magnus,
>>>
>>> I can't quite oversee your situation correctly, but it sounds like  
>>> you have might have set the zone parameter on your actionlink for  
>>> downloading your pdf. If your link returns a stream, tapestry  
>>> cannot add the required JSON needed for appropriate zone handling  
>>> and consequently obstructing the next zone updates. If this is the  
>>> case, remove the zone parameter from your downloading link and it  
>>> should work fine. Otherwise, post your code.
>>>
>>> Cheers,
>>> Joost
>>>
>>>
>>> Magnus Rundberget wrote:
>>>> Hi,
>>>>
>>>> I have a page with a left hand listing of reports and a righthand  
>>>> zone showing details for the reports when clicking reportlinks in  
>>>> the listing. In the zone I have an actionlink for downloading a  
>>>> pdf version of the report.
>>>>
>>>> When clicking the links in the listing the zone updates  
>>>> correctly. But as soon as I click and download a pdf, the report- 
>>>> links on the lefthand side seizes to work. To get them working  
>>>> again I have to refresh the page.
>>>>
>>>> Using firebug I can see that the actionlink posts and receives  
>>>> the correct response, but the zone is never updated. Tried  
>>>> debugging the Tapestry Javascript but can't figure out where  
>>>> exactly it fails.
>>>> (It does enter ZoneManager.updateFromURL, but never invokes  
>>>> ZoneManager.processReply)
>>>>
>>>>
>>>> I've used the following wiki page as inspiration for returing the  
>>>> pdf:
>>>> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
>>>>
>>>>
>>>> anyone got any ideas ?
>>>>
>>>> regards
>>>> Magnus
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: streamresponse actionlink and zone problem

Posted by "Joost Schouten (ml)" <jo...@jsportal.com>.
I think your pdf download will be upsetting your page state in some way. 
I generally choose to make a separate page to handle downloads. 
Otherwise isolation seems the way forward I would say and focus on the 
debuging javascript and the errors you might get there.

Magnus Rundberget wrote:
> Cheers,
>
> Thx for swift reply.
>
> - Not using zone param in the actionlink for downloading the pdf though.
>
> I can't post the complete code (as its a whole lot going on :-)
>
>
> The page has the following layout;
> - Left column; Listing reports. Each report represented by an 
> actionlink with zone param="reportDetails" (<t:actionlink 
> t:id="selectReport" context="report.id" 
> zone="reportDetails">${report.name}</t:actionlink>)
> - Right column: Showing details about a report. The details are 
> wrapped in a zone "reportDetails". Inside the zone is an actionlink to 
> download a pdf (<t:actionlink 
> t:id="downloadPdf">${message:report-downloadPdf}</t:actionlink>)
>
>
> the page class has the following code for the actionlinks mentioned 
> above;
>
> // download pdf
> StreamResponse onActionFromDownloadPdf() {
>        /* this code basically constructs a pdf and returns a 
> StreamResponse, as described in 
> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile */ 
>
>      return new PDFTransformer().generatePDF(report);
>     }
>
> // actionlink for returning reportDetails Zone
> Object onActionFromSelectReport(int id) {
>         Report report = reportRepository.findById(id);
>         return reportDetails.getBody();
>     }
>
>
> not much magic in this. Obviously since the page has lots of other 
> stuff, this could be the cause,
> I might have to make a simpler page to isolate the problem, but was 
> hoping that maybe someone else has stumbled upon a similar scenario...
>
> kind regards
> Magnus
>
>
>
>
>
>
>
>
> On 8. sep.. 2009, at 10.51, Joost Schouten (ml) wrote:
>
>> Hi Magnus,
>>
>> I can't quite oversee your situation correctly, but it sounds like 
>> you have might have set the zone parameter on your actionlink for 
>> downloading your pdf. If your link returns a stream, tapestry cannot 
>> add the required JSON needed for appropriate zone handling and 
>> consequently obstructing the next zone updates. If this is the case, 
>> remove the zone parameter from your downloading link and it should 
>> work fine. Otherwise, post your code.
>>
>> Cheers,
>> Joost
>>
>>
>> Magnus Rundberget wrote:
>>> Hi,
>>>
>>> I have a page with a left hand listing of reports and a righthand 
>>> zone showing details for the reports when clicking reportlinks in 
>>> the listing. In the zone I have an actionlink for downloading a pdf 
>>> version of the report.
>>>
>>> When clicking the links in the listing the zone updates correctly. 
>>> But as soon as I click and download a pdf, the report-links on the 
>>> lefthand side seizes to work. To get them working again I have to 
>>> refresh the page.
>>>
>>> Using firebug I can see that the actionlink posts and receives the 
>>> correct response, but the zone is never updated. Tried debugging the 
>>> Tapestry Javascript but can't figure out where exactly it fails.
>>> (It does enter ZoneManager.updateFromURL, but never invokes 
>>> ZoneManager.processReply)
>>>
>>>
>>> I've used the following wiki page as inspiration for returing the pdf:
>>> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile 
>>>
>>>
>>>
>>> anyone got any ideas ?
>>>
>>> regards
>>> Magnus
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: streamresponse actionlink and zone problem

Posted by Magnus Rundberget <ru...@me.com>.
Cheers,

Thx for swift reply.

- Not using zone param in the actionlink for downloading the pdf though.

I can't post the complete code (as its a whole lot going on :-)


The page has the following layout;
- Left column; Listing reports. Each report represented by an  
actionlink with zone param="reportDetails" (<t:actionlink  
t:id="selectReport" context="report.id" zone="reportDetails">$ 
{report.name}</t:actionlink>)
- Right column: Showing details about a report. The details are  
wrapped in a zone "reportDetails". Inside the zone is an actionlink to  
download a pdf (<t:actionlink t:id="downloadPdf">${message:report-downloadPdf 
}</t:actionlink>)


the page class has the following code for the actionlinks mentioned  
above;

// download pdf
StreamResponse onActionFromDownloadPdf() {
        /* this code basically constructs a pdf and returns a  
StreamResponse, as described in http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile 
  */
	 return new PDFTransformer().generatePDF(report);
     }

// actionlink for returning reportDetails Zone
Object onActionFromSelectReport(int id) {
         Report report = reportRepository.findById(id);
         return reportDetails.getBody();
     }


not much magic in this. Obviously since the page has lots of other  
stuff, this could be the cause,
I might have to make a simpler page to isolate the problem, but was  
hoping that maybe someone else has stumbled upon a similar scenario...

kind regards
Magnus








On 8. sep.. 2009, at 10.51, Joost Schouten (ml) wrote:

> Hi Magnus,
>
> I can't quite oversee your situation correctly, but it sounds like  
> you have might have set the zone parameter on your actionlink for  
> downloading your pdf. If your link returns a stream, tapestry cannot  
> add the required JSON needed for appropriate zone handling and  
> consequently obstructing the next zone updates. If this is the case,  
> remove the zone parameter from your downloading link and it should  
> work fine. Otherwise, post your code.
>
> Cheers,
> Joost
>
>
> Magnus Rundberget wrote:
>> Hi,
>>
>> I have a page with a left hand listing of reports and a righthand  
>> zone showing details for the reports when clicking reportlinks in  
>> the listing. In the zone I have an actionlink for downloading a pdf  
>> version of the report.
>>
>> When clicking the links in the listing the zone updates correctly.  
>> But as soon as I click and download a pdf, the report-links on the  
>> lefthand side seizes to work. To get them working again I have to  
>> refresh the page.
>>
>> Using firebug I can see that the actionlink posts and receives the  
>> correct response, but the zone is never updated. Tried debugging  
>> the Tapestry Javascript but can't figure out where exactly it fails.
>> (It does enter ZoneManager.updateFromURL, but never invokes  
>> ZoneManager.processReply)
>>
>>
>> I've used the following wiki page as inspiration for returing the  
>> pdf:
>> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
>>
>>
>> anyone got any ideas ?
>>
>> regards
>> Magnus
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: streamresponse actionlink and zone problem

Posted by "Joost Schouten (ml)" <jo...@jsportal.com>.
Hi Magnus,

I can't quite oversee your situation correctly, but it sounds like you 
have might have set the zone parameter on your actionlink for 
downloading your pdf. If your link returns a stream, tapestry cannot add 
the required JSON needed for appropriate zone handling and consequently 
obstructing the next zone updates. If this is the case, remove the zone 
parameter from your downloading link and it should work fine. Otherwise, 
post your code.

Cheers,
Joost


Magnus Rundberget wrote:
> Hi,
>
> I have a page with a left hand listing of reports and a righthand zone 
> showing details for the reports when clicking reportlinks in the 
> listing. In the zone I have an actionlink for downloading a pdf 
> version of the report.
>
> When clicking the links in the listing the zone updates correctly. But 
> as soon as I click and download a pdf, the report-links on the 
> lefthand side seizes to work. To get them working again I have to 
> refresh the page.
>
> Using firebug I can see that the actionlink posts and receives the 
> correct response, but the zone is never updated. Tried debugging the 
> Tapestry Javascript but can't figure out where exactly it fails.
> (It does enter ZoneManager.updateFromURL, but never invokes 
> ZoneManager.processReply)
>
>
> I've used the following wiki page as inspiration for returing the pdf:
> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile
>
>
> anyone got any ideas ?
>
> regards
> Magnus
>
> ---------------------------------------------------------------------
> 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