You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark <ma...@xeric.net> on 2011/07/18 05:13:02 UTC

PageActivationContext Coercion Exceptions

I have an app with several pages like:

www.app.com/itemInfo/1

where 1 is the page activation context and gets coerced into the
object using Tapestry-Hibernate.  This works great, but... the graphic
designer accidentally added a link into the header without the http. I
fixed it, but not before Google indexed the site. Now the GoogleBot
keeps calling urls like:

www.app.com/itemInfo/www.example.com

Obviously www.example.com can't be turned into a Long and then into
the object so it gives an exception.

Is there an easy way to globally say, "if type coercion fails, just
return a 404?"  If not is there a way to catch the exception?

Mark

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


Re: PageActivationContext Coercion Exceptions

Posted by Mark <ma...@xeric.net>.
Thanks, Kalle.  I'll check that out.

I also found that you can intercept the exceptions which I had
overlooked in the docs:
http://tapestry.apache.org/component-events.html

Mark

On Sun, Jul 17, 2011 at 10:49 PM, Kalle Korhonen
<ka...@gmail.com> wrote:
> I haven't tried, but using tapestry-exceptionpage
> (http://tynamo.org/tapestry-exceptionpage+guide) you should be able to
> map UnknownValueException to your 404 page.
>
> Kalle
>
>
> On Sun, Jul 17, 2011 at 8:13 PM, Mark <ma...@xeric.net> wrote:
>> I have an app with several pages like:
>>
>> www.app.com/itemInfo/1
>>
>> where 1 is the page activation context and gets coerced into the
>> object using Tapestry-Hibernate.  This works great, but... the graphic
>> designer accidentally added a link into the header without the http. I
>> fixed it, but not before Google indexed the site. Now the GoogleBot
>> keeps calling urls like:
>>
>> www.app.com/itemInfo/www.example.com
>>
>> Obviously www.example.com can't be turned into a Long and then into
>> the object so it gives an exception.
>>
>> Is there an easy way to globally say, "if type coercion fails, just
>> return a 404?"  If not is there a way to catch the exception?
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: PageActivationContext Coercion Exceptions

Posted by Kalle Korhonen <ka...@gmail.com>.
I haven't tried, but using tapestry-exceptionpage
(http://tynamo.org/tapestry-exceptionpage+guide) you should be able to
map UnknownValueException to your 404 page.

Kalle


On Sun, Jul 17, 2011 at 8:13 PM, Mark <ma...@xeric.net> wrote:
> I have an app with several pages like:
>
> www.app.com/itemInfo/1
>
> where 1 is the page activation context and gets coerced into the
> object using Tapestry-Hibernate.  This works great, but... the graphic
> designer accidentally added a link into the header without the http. I
> fixed it, but not before Google indexed the site. Now the GoogleBot
> keeps calling urls like:
>
> www.app.com/itemInfo/www.example.com
>
> Obviously www.example.com can't be turned into a Long and then into
> the object so it gives an exception.
>
> Is there an easy way to globally say, "if type coercion fails, just
> return a 404?"  If not is there a way to catch the exception?
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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