You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Maurice Marrink <ma...@gmail.com> on 2008/04/07 12:46:20 UTC

RestartResponseAtInterceptPageException during onBeforeRender

Does anybody know of reasons not to allow throwing a RRAIPE during
onBeforeRender?
Currently this is not possible but perhaps we should support it.
Consider the following use case
A Page with a LDM containing object x.
The Page has a link to delete x from the database, after delete
another Page is set as the responsePage.
Now if the user clicks on the backbutton of the browser the LDM tries
to reload object x from the database, which will not work because we
just deleted it.
So we detect this situation in the LDM#load method and throw a RRAIPE.
The problem is since load is triggered from onBeforeRender it is
caught by MarkupContainer#onBeforeRenderChildren() which is nice
enoygh to let all WicketRuntimeExceptions pass unmodified but wraps
every other Exception inside a WRE.
The problem here is that RRAIPE is not a WRE.

Possible solutions are make AbortException extends WRE, make WRE an
interface that is implemented by RRAIPE and modify the try-catch in
MarkupContainer#onBeforeRenderChildren to also let the RRAIPE pass
unmodified

WDYT?

Maurice

Re: RestartResponseAtInterceptPageException during onBeforeRender

Posted by Igor Vaynberg <ig...@gmail.com>.
well, without the patch youd have to try and catch it anywhere we
catch a runtime exception and wrap it into wicketruntimeexception,
which can get pretty error prone. but even independently of that the
patch should probably still be applied even if only as a safety net.

-igor

On Mon, Apr 7, 2008 at 11:58 AM, Maurice Marrink <ma...@gmail.com> wrote:
> What can i say Igor :)
>  Anyway i have looked at the patch and while i think it is going to
>  work and probably be a lot safer (in the meaning of us not forgetting
>  a catch(Abort) somewhere) i worry the wrapping of exceptions and thus
>  the generation of extra stacktraces will mean a sizable performance
>  hit. Not that this will happen on every request or will wrap like 10
>  layers but still :)
>
>  I'll get back to you after i tested the patch.
>
>  Maurice
>
>
>
>  On Mon, Apr 7, 2008 at 5:36 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>  > you guys mean https://issues.apache.org/jira/browse/WICKET-1418 right? :)
>  >  who is going to link all 3?
>  >
>  >  i wrote up a patch for 1418 and posted for a review here but no one
>  >  seemed interesting in opining.
>  >
>  >  -igor
>  >
>  >
>  >
>  >  On Mon, Apr 7, 2008 at 4:02 AM, Johan Compagner <jc...@gmail.com> wrote:
>  >  > dont know if we can extend it from WRE as easy.
>  >  >  Because then we have to walk over all the checks because i can think of
>  >  >  things where we do:
>  >  >
>  >  >  try
>  >  >  {
>  >  >  }
>  >  >  catch(WRE)
>  >  >  {
>  >  >  }
>  >  >  catch(AbortException)
>  >  >  {
>  >  >  }
>  >  >
>  >  >  so then we need to check all our catch code carefully.
>  >  >
>  >  >  But didnt another also had an issue with this?
>  >  >  Also https://issues.apache.org/jira/browse/WICKET-1478
>  >  >  why does that abort exception work for him? (he has another problem but the
>  >  >  abort works for him)
>  >  >
>  >  >  johan
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  On Mon, Apr 7, 2008 at 12:46 PM, Maurice Marrink <ma...@gmail.com> wrote:
>  >  >
>  >  >  > Does anybody know of reasons not to allow throwing a RRAIPE during
>  >  >  > onBeforeRender?
>  >  >  > Currently this is not possible but perhaps we should support it.
>  >  >  > Consider the following use case
>  >  >  > A Page with a LDM containing object x.
>  >  >  > The Page has a link to delete x from the database, after delete
>  >  >  > another Page is set as the responsePage.
>  >  >  > Now if the user clicks on the backbutton of the browser the LDM tries
>  >  >  > to reload object x from the database, which will not work because we
>  >  >  > just deleted it.
>  >  >  > So we detect this situation in the LDM#load method and throw a RRAIPE.
>  >  >  > The problem is since load is triggered from onBeforeRender it is
>  >  >  > caught by MarkupContainer#onBeforeRenderChildren() which is nice
>  >  >  > enoygh to let all WicketRuntimeExceptions pass unmodified but wraps
>  >  >  > every other Exception inside a WRE.
>  >  >  > The problem here is that RRAIPE is not a WRE.
>  >  >  >
>  >  >  > Possible solutions are make AbortException extends WRE, make WRE an
>  >  >  > interface that is implemented by RRAIPE and modify the try-catch in
>  >  >  > MarkupContainer#onBeforeRenderChildren to also let the RRAIPE pass
>  >  >  > unmodified
>  >  >  >
>  >  >  > WDYT?
>  >  >  >
>  >  >  > Maurice
>  >  >  >
>  >  >
>  >
>

Re: RestartResponseAtInterceptPageException during onBeforeRender

Posted by Maurice Marrink <ma...@gmail.com>.
What can i say Igor :)
Anyway i have looked at the patch and while i think it is going to
work and probably be a lot safer (in the meaning of us not forgetting
a catch(Abort) somewhere) i worry the wrapping of exceptions and thus
the generation of extra stacktraces will mean a sizable performance
hit. Not that this will happen on every request or will wrap like 10
layers but still :)

I'll get back to you after i tested the patch.

Maurice

On Mon, Apr 7, 2008 at 5:36 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> you guys mean https://issues.apache.org/jira/browse/WICKET-1418 right? :)
>  who is going to link all 3?
>
>  i wrote up a patch for 1418 and posted for a review here but no one
>  seemed interesting in opining.
>
>  -igor
>
>
>
>  On Mon, Apr 7, 2008 at 4:02 AM, Johan Compagner <jc...@gmail.com> wrote:
>  > dont know if we can extend it from WRE as easy.
>  >  Because then we have to walk over all the checks because i can think of
>  >  things where we do:
>  >
>  >  try
>  >  {
>  >  }
>  >  catch(WRE)
>  >  {
>  >  }
>  >  catch(AbortException)
>  >  {
>  >  }
>  >
>  >  so then we need to check all our catch code carefully.
>  >
>  >  But didnt another also had an issue with this?
>  >  Also https://issues.apache.org/jira/browse/WICKET-1478
>  >  why does that abort exception work for him? (he has another problem but the
>  >  abort works for him)
>  >
>  >  johan
>  >
>  >
>  >
>  >
>  >  On Mon, Apr 7, 2008 at 12:46 PM, Maurice Marrink <ma...@gmail.com> wrote:
>  >
>  >  > Does anybody know of reasons not to allow throwing a RRAIPE during
>  >  > onBeforeRender?
>  >  > Currently this is not possible but perhaps we should support it.
>  >  > Consider the following use case
>  >  > A Page with a LDM containing object x.
>  >  > The Page has a link to delete x from the database, after delete
>  >  > another Page is set as the responsePage.
>  >  > Now if the user clicks on the backbutton of the browser the LDM tries
>  >  > to reload object x from the database, which will not work because we
>  >  > just deleted it.
>  >  > So we detect this situation in the LDM#load method and throw a RRAIPE.
>  >  > The problem is since load is triggered from onBeforeRender it is
>  >  > caught by MarkupContainer#onBeforeRenderChildren() which is nice
>  >  > enoygh to let all WicketRuntimeExceptions pass unmodified but wraps
>  >  > every other Exception inside a WRE.
>  >  > The problem here is that RRAIPE is not a WRE.
>  >  >
>  >  > Possible solutions are make AbortException extends WRE, make WRE an
>  >  > interface that is implemented by RRAIPE and modify the try-catch in
>  >  > MarkupContainer#onBeforeRenderChildren to also let the RRAIPE pass
>  >  > unmodified
>  >  >
>  >  > WDYT?
>  >  >
>  >  > Maurice
>  >  >
>  >
>

Re: RestartResponseAtInterceptPageException during onBeforeRender

Posted by Igor Vaynberg <ig...@gmail.com>.
you guys mean https://issues.apache.org/jira/browse/WICKET-1418 right? :)
who is going to link all 3?

i wrote up a patch for 1418 and posted for a review here but no one
seemed interesting in opining.

-igor

On Mon, Apr 7, 2008 at 4:02 AM, Johan Compagner <jc...@gmail.com> wrote:
> dont know if we can extend it from WRE as easy.
>  Because then we have to walk over all the checks because i can think of
>  things where we do:
>
>  try
>  {
>  }
>  catch(WRE)
>  {
>  }
>  catch(AbortException)
>  {
>  }
>
>  so then we need to check all our catch code carefully.
>
>  But didnt another also had an issue with this?
>  Also https://issues.apache.org/jira/browse/WICKET-1478
>  why does that abort exception work for him? (he has another problem but the
>  abort works for him)
>
>  johan
>
>
>
>
>  On Mon, Apr 7, 2008 at 12:46 PM, Maurice Marrink <ma...@gmail.com> wrote:
>
>  > Does anybody know of reasons not to allow throwing a RRAIPE during
>  > onBeforeRender?
>  > Currently this is not possible but perhaps we should support it.
>  > Consider the following use case
>  > A Page with a LDM containing object x.
>  > The Page has a link to delete x from the database, after delete
>  > another Page is set as the responsePage.
>  > Now if the user clicks on the backbutton of the browser the LDM tries
>  > to reload object x from the database, which will not work because we
>  > just deleted it.
>  > So we detect this situation in the LDM#load method and throw a RRAIPE.
>  > The problem is since load is triggered from onBeforeRender it is
>  > caught by MarkupContainer#onBeforeRenderChildren() which is nice
>  > enoygh to let all WicketRuntimeExceptions pass unmodified but wraps
>  > every other Exception inside a WRE.
>  > The problem here is that RRAIPE is not a WRE.
>  >
>  > Possible solutions are make AbortException extends WRE, make WRE an
>  > interface that is implemented by RRAIPE and modify the try-catch in
>  > MarkupContainer#onBeforeRenderChildren to also let the RRAIPE pass
>  > unmodified
>  >
>  > WDYT?
>  >
>  > Maurice
>  >
>

Re: RestartResponseAtInterceptPageException during onBeforeRender

Posted by Johan Compagner <jc...@gmail.com>.
dont know if we can extend it from WRE as easy.
Because then we have to walk over all the checks because i can think of
things where we do:

try
{
}
catch(WRE)
{
}
catch(AbortException)
{
}

so then we need to check all our catch code carefully.

But didnt another also had an issue with this?
Also https://issues.apache.org/jira/browse/WICKET-1478
why does that abort exception work for him? (he has another problem but the
abort works for him)

johan


On Mon, Apr 7, 2008 at 12:46 PM, Maurice Marrink <ma...@gmail.com> wrote:

> Does anybody know of reasons not to allow throwing a RRAIPE during
> onBeforeRender?
> Currently this is not possible but perhaps we should support it.
> Consider the following use case
> A Page with a LDM containing object x.
> The Page has a link to delete x from the database, after delete
> another Page is set as the responsePage.
> Now if the user clicks on the backbutton of the browser the LDM tries
> to reload object x from the database, which will not work because we
> just deleted it.
> So we detect this situation in the LDM#load method and throw a RRAIPE.
> The problem is since load is triggered from onBeforeRender it is
> caught by MarkupContainer#onBeforeRenderChildren() which is nice
> enoygh to let all WicketRuntimeExceptions pass unmodified but wraps
> every other Exception inside a WRE.
> The problem here is that RRAIPE is not a WRE.
>
> Possible solutions are make AbortException extends WRE, make WRE an
> interface that is implemented by RRAIPE and modify the try-catch in
> MarkupContainer#onBeforeRenderChildren to also let the RRAIPE pass
> unmodified
>
> WDYT?
>
> Maurice
>