Re: T5: onActivate error handling?

2007-02-23 Thread D&J Gredler

The onActivate(Object[]) solution works well, thanks.

I've opened an enhancement request in JIRA to track this change, too:

https://issues.apache.org/jira/browse/TAPESTRY-1295


On 2/23/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:


Yes, this is tricky and I'm thinking I'm not happy with the way it
currently works.

Your best option is to implement onActivate(Object[]) and do any
coercions from there.  This will be invoked regardless of the number
of values in the context (even zero).

I'm thinking the change will be:  a method will be invoked if the
context has at least as many values as the method has parameters, and
will silently skip those that request too many.

Nope, that still doesn't handle it for the common case that you want
to catch the "no activation context" scenario.

On 2/23/07, D&J Gredler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using the activate / passivate infrastructure in T5, and have a
question
> about it. I have the following methods on a search page:
>
> public String onPassivate() {
> return this.jurisdiction;
> }
>
> public void onActivate(String jurisdiction) {
> this.jurisdiction = jurisdiction;
> }
>
> This works for URLs of the form "http://www.host.com/search/atlanta";.
> However, if a user ever goes to "http://www.host.com/search";, he will
get an
> ugly error page for an IllegalArgumentException, with a message like
"Method
> com.of.pages.AbstractJurisdictionPage.onActivate(java.lang.String) has
more
> parameters than there are context values for this component event."
>
> I'd like to be able to handle this condition myself, and thought I might
be
> able to do so if I added a parameter-less onActivate( ) method, but no
> cigar:
>
> public void onActivate() {
> // redirect to home page, or use a default jurisdiction
> }
>
> What are my options here?
>
> Daniel
>


--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache 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]




Re: T5: onActivate error handling?

2007-02-23 Thread Howard Lewis Ship

Yes, this is tricky and I'm thinking I'm not happy with the way it
currently works.

Your best option is to implement onActivate(Object[]) and do any
coercions from there.  This will be invoked regardless of the number
of values in the context (even zero).

I'm thinking the change will be:  a method will be invoked if the
context has at least as many values as the method has parameters, and
will silently skip those that request too many.

Nope, that still doesn't handle it for the common case that you want
to catch the "no activation context" scenario.

On 2/23/07, D&J Gredler <[EMAIL PROTECTED]> wrote:

Hi,

I'm using the activate / passivate infrastructure in T5, and have a question
about it. I have the following methods on a search page:

public String onPassivate() {
return this.jurisdiction;
}

public void onActivate(String jurisdiction) {
this.jurisdiction = jurisdiction;
}

This works for URLs of the form "http://www.host.com/search/atlanta";.
However, if a user ever goes to "http://www.host.com/search";, he will get an
ugly error page for an IllegalArgumentException, with a message like "Method
com.of.pages.AbstractJurisdictionPage.onActivate(java.lang.String) has more
parameters than there are context values for this component event."

I'd like to be able to handle this condition myself, and thought I might be
able to do so if I added a parameter-less onActivate( ) method, but no
cigar:

public void onActivate() {
// redirect to home page, or use a default jurisdiction
}

What are my options here?

Daniel




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache 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]



T5: onActivate error handling?

2007-02-23 Thread D&J Gredler

Hi,

I'm using the activate / passivate infrastructure in T5, and have a question
about it. I have the following methods on a search page:

   public String onPassivate() {
   return this.jurisdiction;
   }

   public void onActivate(String jurisdiction) {
   this.jurisdiction = jurisdiction;
   }

This works for URLs of the form "http://www.host.com/search/atlanta";.
However, if a user ever goes to "http://www.host.com/search";, he will get an
ugly error page for an IllegalArgumentException, with a message like "Method
com.of.pages.AbstractJurisdictionPage.onActivate(java.lang.String) has more
parameters than there are context values for this component event."

I'd like to be able to handle this condition myself, and thought I might be
able to do so if I added a parameter-less onActivate( ) method, but no
cigar:

   public void onActivate() {
   // redirect to home page, or use a default jurisdiction
   }

What are my options here?

Daniel