You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Richard Watson <rw...@csir.co.za> on 2004/09/08 12:17:40 UTC

validate

Hi,

I just need to check something.  I'm refactoring some code (more about
that in a future email) and I remember some issue I had, which I'm
fixing and I'm not sure I have to :)

I had some secure pages, and some public ones.  For various reasons, I
had a SecureBasePage that did some validation, and a PublicBasePage that
inherited from the SecureBasePage and overrode the validation code to do
nothing.  Now, I remember Tapestry being unhappy with me on the
PublicBasePage due to this and I had to do some labourious workarounds. 
In the present code I'm creating a PageSecurityDelegate so I don't have
to override anything again...but...

...was I just doing something silly?  Is it possible to override
validate() more than once?

Richard


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


Re: validate

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Sep 8, 2004, at 6:17 AM, Richard Watson wrote:
> ...was I just doing something silly?  Is it possible to override
> validate() more than once?

Likely you were doing something silly :)

It's just Java, so all inheritance/overriding rules apply.  Overriding 
a method at any level of the hierarchy is ok as long as you haven't 
made it 'final'.

	Erik


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


Re: validate [auf Viren geprueft]

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
The Template design pattern works well when faced with a scenario like  
this.

	http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/ 
TemplatePattern.htm

(first hit on Google, not necessarily the best description of it)

I used this particular pattern to do something similar back in my  
Struts daze on our BaseAction class.

	Erik

On Sep 8, 2004, at 7:39 AM, Jonathan O'Connor wrote:

> Richard,
> I know that Tapestry checks some methods to see if the super.method()  
> was
> called. detach works like that. Maybe validate() is also checked.
> But you can probably do the following:
> public void PublicBasePage.validate() { AbstractBasePage.validate(); }
>
> Of course, this code smells bad, so your class hierarchy could do with  
> a
> bit of refactoring to avoid this kind of rubbish :-)
> Ciao,
> Jonathan O'Connor
> XCOM Dublin
>
>
>
> Richard Watson <rw...@csir.co.za>
> 08/09/2004 11:17
> Please respond to
> "Tapestry users" <ta...@jakarta.apache.org>
>
>
> To
> tapestry-user@jakarta.apache.org
> cc
>
> Subject
> validate [auf Viren geprueft]
>
>
>
>
>
>
> Hi,
>
> I just need to check something.  I'm refactoring some code (more about
> that in a future email) and I remember some issue I had, which I'm
> fixing and I'm not sure I have to :)
>
> I had some secure pages, and some public ones.  For various reasons, I
> had a SecureBasePage that did some validation, and a PublicBasePage  
> that
> inherited from the SecureBasePage and overrode the validation code to  
> do
> nothing.  Now, I remember Tapestry being unhappy with me on the
> PublicBasePage due to this and I had to do some labourious workarounds.
> In the present code I'm creating a PageSecurityDelegate so I don't have
> to override anything again...but...
>
> ...was I just doing something silly?  Is it possible to override
> validate() more than once?
>
> Richard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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


Re: validate [auf Viren geprueft]

Posted by Jonathan O'Connor <Jo...@xcom.de>.
Richard,
I know that Tapestry checks some methods to see if the super.method() was 
called. detach works like that. Maybe validate() is also checked.
But you can probably do the following:
public void PublicBasePage.validate() { AbstractBasePage.validate(); }

Of course, this code smells bad, so your class hierarchy could do with a 
bit of refactoring to avoid this kind of rubbish :-)
Ciao,
Jonathan O'Connor
XCOM Dublin



Richard Watson <rw...@csir.co.za> 
08/09/2004 11:17
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


To
tapestry-user@jakarta.apache.org
cc

Subject
validate [auf Viren geprueft]






Hi,

I just need to check something.  I'm refactoring some code (more about
that in a future email) and I remember some issue I had, which I'm
fixing and I'm not sure I have to :)

I had some secure pages, and some public ones.  For various reasons, I
had a SecureBasePage that did some validation, and a PublicBasePage that
inherited from the SecureBasePage and overrode the validation code to do
nothing.  Now, I remember Tapestry being unhappy with me on the
PublicBasePage due to this and I had to do some labourious workarounds. 
In the present code I'm creating a PageSecurityDelegate so I don't have
to override anything again...but...

...was I just doing something silly?  Is it possible to override
validate() more than once?

Richard


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