I take it by the deafening silence that this is either exceptionally trivial or 
exceptionally hard. Has anyone got any ideas?

Thanks,

Rob Cole
CSA Web




                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
             "Robert Cole" <[EMAIL PROTECTED]>                                  
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                    
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
             27/09/2005 14:45                                                   
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                           To 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
        tapestry-user@jakarta.apache.org                                        
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                           cc 
                                                                                
                                                                                
                                     Please respond to                          
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                    "Tapestry users" <tapestry-user@jakarta.apache.org>         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                      Subject 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
        Page recorder for page X locked after a commit()                        
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                              




Hi All,

Tapestry 3.0.3 on JDK 1.5

I'm running into the locked page problem when trying to read the content of 
multiple pages to generate a PDF.

Some background. We've written a page that is used to display company 
information for 200 companies. The pages a normally viewed as HTML, but I've 
written some code that uses the IRequestCycle to render the page that I capture 
and convert to a PDF, which all works fine.

The problem is that now we need to convert all of the company pages to 1 big 
PDF rather than 200 small ones. I don't want to write a page that shows every 
company page as an HTML page and then convert that as it would use a large 
amount of memory and CPU. So, I'm trying to convert each page at a time and 
then get the 1st page of the PDF and add that to a larger document.

So, the process goes:
   Service receives request.
   Gets list of companies
   For each company:
      Generate the HTML page
      Convert to PDF
      Add pdf page to big report

The problem is that the second time I try to activate the company page I get 
the error shown below:

org.apache.tapestry.ApplicationRuntimeException
Page recorder for page Issuer is locked after a commit(), but received a change 
to property issuerTicker of component Issuer.

The code that activates the page is below. The "cycle" object is the instance 
of IRequestCycle that is represents the request, so its the one that's passed 
into the service that is doing all of the work, so the same cycle is used each 
time I use the underlying page to generate the HTML (see where this is going?)

        IPage page = cycle.getPage(pageName);
        cycle.setServiceParameters(parameters);
        cycle.activate(page);

        if (page instanceof IExternalPage) {
            IExternalPage externalPage = (IExternalPage) page;
            externalPage.activateExternalPage(parameters, cycle);
        }

        byte[] response = renderAndCaptureResponse(cycle);

The last method is:

    private byte[] renderAndCaptureResponse(IRequestCycle cycle) {

        ByteArrayOutputStream output = new ByteArrayOutputStream(2046);
        IPage page = cycle.getPage();
        IMarkupWriter writer = page.getResponseWriter(output);
        try {
            cycle.renderPage(writer);
        } finally {
            writer.close();
        }

        return output.toByteArray();
    }

Having looked at the documentation around the page recorder I can see that the 
commit() method locks the PageRecorder until the next request cycle. So, when I 
come to use the page with a new set of parameters, the page falls over with the 
exception since I'm using the same cycle each time.

The question is, how do I get around it, or stop it happening? Can I create a 
new IRequestCycle object, or clone the existing one so that each page is 
rendered for a different request cycle? Or can I tell the page recorder to 
uncommit the commit?

Thanks,

Rob Cole
CSA Web



--

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.



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






--

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.



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

Reply via email to