On 7/17/05, Onno Scheffers <[EMAIL PROTECTED]> wrote:
> I've been using Tapestry 3.0.3 for previous projects and for my next
> project I wanted to use Tapestry 4 and Java5. This is the first time I'm
> using Tapestry 4 (I downloaded beta2). So I'm struggling a bit with the
> new features and new ways of doing things:
> 
> What happened to the initialize() method?
> Javadoc says it's deprecated and there won't be a replacement method for
> it. Does that mean I don't have to initialize my properties anymore
> before the page is returned to the pool? Does that happen automatically
> now, or do I still need to do something myself to make sure the pages
> are properly cleaned?

initialize() dates back to 2.x, and was a hook to reset state. 
Abstract properties in 3.0 made this unncessary.  In addition, there
are listener interfaces (PageAttachListener and PageDetachListener) to
support this behavior much more nicely.

Last week, I found out that the initialize() method makes it
impossible to use EasyMock to mock Tapestry pages!  It has to do ...
maybe sooner rather than later.


> If cleaning happens automatically now, is there still any reason to
> create abstract pages? Abstract pages were previously only required to
> let Tapestry do the dirty work of creating the getters/setters and
> initialize methods as far as I know?

Abstract pages are the solution to initialize().  The code written by
Tapestry in 3.0 and 4.0 to clear out request- and user-specific data
is written into the abstract methods.  4.0 does a more sophisiticated
and efficient job of it than 3.0 ... it uses virtually no reflection
to set or update the properties (outside of OGNL expressions, of
course).

> 
> Can empty page-specifications now be removed? I tried the QuickStart
> DirectLink Guide, which doesn't seem to define a .page-file and I did
> set the meta key 'org.apache.tapestry.page-class-packages' to the
> package containing my Page implementations.
> Tapestry kept complaining that it couldn't locate the page unless I
> added an empty page-specification. Then it worked flawlessly, even
> though I didn't even tell the page-specification the Class it should use
> (so it could figure out the proper Page-class, just not without a
> .page-file).


You shouldn't need a .page file if you set this meta property; I'll
have to double check that its working correctly.  There's a similar
bug concerning components (which need to have a .jwc file but
shouldn't).

> Did anyone else have this problem? Am I doing something wrong here or
> are empty .page-files still mandatory?
> 
> 
> Regards,
> 
> Onno
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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

Reply via email to