RE: getRequestCycle null after session serializes

"Luke Galea" <[email protected]>
Newsgroups gmane.comp.java.tapestry.devel
Message-ID <[email protected]>
Sorry.. Basically I am trying to use my page to provide a data source to
the table component I am including. I am setting up the tableModel, etc
in the finishLoad method but I am (as you suspected) keeping a reference
to the page.. I can't really find any good way around this, because if I
use a ComponentReference then I need the request cycle to resolve it to
the component.. which I can't do unless I modify the guts of the
contrib. table component.. which I'd rather not do as some day I would
like to release my hibernate data model to work with the existing
contrib code.. 
 
Perhaps I could initialize the table model in something other than
finishLoad? But then it would needlessly occur.. 
My other thought is that if the ITableSessionStateManager had access to
the IRequestCycle in recreateTableModel, then this would all be a lot
easier.. 
 
Anyway... Thanks again for the help.. here is my finishLoad (which is
the root of all this evil)..
 
protected void finishLoad()
    {
        super.finishLoad();
        
        IHibernateTableDataSource dataSource = new
SimpleHibernateTableDataSource( 
            this, 
            "com.bluecatnetworks.meridius.quarantine.data.User" );
        
        SimpleTableColumnModel columnModel = new SimpleTableColumnModel(
new ITableColumn[] {                
                new SizeLimitedHibernateExpressionTableColumn( "User",
"emailAddress.address", true, 30 ), 
                new SizeLimitedHibernateExpressionTableColumn( "Last
Access", "lastAccessed", true, 15 ),
                new SizeLimitedHibernateExpressionTableColumn(
"Messages", "quarantinedMessages.size()", false, 5 )
            } );
        
        stateManager = new HibernateTableSessionStateManager(
dataSource, columnModel );
        
        tableModel = new HibernateTableModel( dataSource, columnModel );
    }
 
Luke Galea 
Software Development
BlueCat Networks <http://www.bluecatnetworks.com/> 
905-762-5225
 
-----Original Message-----
From: Howard M. Lewis Ship [mailto:[email protected]] 
Sent: December 28, 2002 11:23 AM
To: Luke Galea; Tapestry Developer
Subject: Re: [Tapestry-developer] getRequestCycle null after session
serializes
 
I'd need to see a little more code to figure out what you are doing.  My
guess is that you are expecting the same page instance to process your
subsequent requests and that doesn't happen, especially with paging.
 
For something to survive from one request cycle to another, it must be
stored in the HttpSession (directly) or indirectly as a persistent page
property, or as part of the Visit.  Disabling caching forces out into
the open these kind of problems, since you are guaranteed to never use
teh same page instance twice.
----- Original Message ----- 
From: Luke Galea <mailto:[email protected]>  
To: Tapestry Developer <mailto:[email protected]>

Sent: Thursday, November 28, 2002 9:22 AM
Subject: [Tapestry-developer] getRequestCycle null after session
serializes
 
Hello,
         I have a strange problem (well.. at least I think it's
strange). I have extended BasePage for pages that need validation and
access to the database. In my page I have a method: "getSession" that
pulls the db connection data from the request cycle ( or checks if it is
already there really ). 
 
It works perfectly until I either: 
1. Disabled page caching and refresh the page or click any links that
involve a refresh
2. With page caching on, wait 2-3 mins or so for the server-side session
to be serialized ( that's my guess at least ) then try and refresh. 
 
I noticed that in the FAQ it says that disabling page caching is a good
way to: "test that you are persisting server-side state correctly".
 
I believe I am doing this correctly, I don't see how even implementing
this incorrectly would result in "getRequestCycle" returning null..
unless perhaps I am forgetting to call super() somewhere?
 
Thanks in advance...
 
Luke Galea 
Software Development
BlueCat Networks <http://www.bluecatnetworks.com/> 
905-762-5225
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.