Re: Exceptions and Ajax Events
Hi there, i want to keep alive this thread. Nobody knows how to access the component which generates the exception in his event from the onRuntimeException method? For example: I have a *Link*, and in his* onclick()* method throw a RuntimeException. So then in the onRuntimeException method, i want to access that especific * Link*. Thanks in advance. NM On Thu, Oct 8, 2009 at 2:43 PM, Nicolas Melendez nmelen...@getsense.com.arwrote: Any clues or suggestions on this issue. Thinks. NM On Thu, Oct 1, 2009 at 11:22 PM, Esteban Masoero emaso...@getsense.com.ar wrote: Hi: We found out we need something else. Is there a way we can access to the component asociated to the listener that was processing the event? (of course it only applies to ajax events), becase from onRuntimeException we ony have the Page. Thanks, Esteban Jeremy Thomerson escribió: something like this in your application should work: @Override public RequestCycle newRequestCycle(Request request, Response response) { return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response) { @Override public Page onRuntimeException(Page page, RuntimeException e) { if (RequestCycle.get().getRequestTarget() instanceof AjaxRequestTarget) { // do something with ajax request targets } return super.onRuntimeException(page, e); } }; } -- Jeremy Thomerson http://www.wickettraining.com On Thu, Oct 1, 2009 at 1:59 PM, Nicolas Melendez nmelen...@getsense.com.arwrote: Hi there,Our team was discussing about if there is a place where all exceptions, that come from an ajax behaviour, can be catched. We want to do this because we strongly belive that exceptions should be catched in one place, but now we have to catch the exception in every ajax method( onSubmit, onChance, etc) in the application. Is there one place in wicket where we can do that? Thank in advance. Our team. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Exceptions and Ajax Events
Any clues or suggestions on this issue.Thinks. NM On Thu, Oct 1, 2009 at 11:22 PM, Esteban Masoero emaso...@getsense.com.arwrote: Hi: We found out we need something else. Is there a way we can access to the component asociated to the listener that was processing the event? (of course it only applies to ajax events), becase from onRuntimeException we ony have the Page. Thanks, Esteban Jeremy Thomerson escribió: something like this in your application should work: @Override public RequestCycle newRequestCycle(Request request, Response response) { return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response) { @Override public Page onRuntimeException(Page page, RuntimeException e) { if (RequestCycle.get().getRequestTarget() instanceof AjaxRequestTarget) { // do something with ajax request targets } return super.onRuntimeException(page, e); } }; } -- Jeremy Thomerson http://www.wickettraining.com On Thu, Oct 1, 2009 at 1:59 PM, Nicolas Melendez nmelen...@getsense.com.arwrote: Hi there,Our team was discussing about if there is a place where all exceptions, that come from an ajax behaviour, can be catched. We want to do this because we strongly belive that exceptions should be catched in one place, but now we have to catch the exception in every ajax method( onSubmit, onChance, etc) in the application. Is there one place in wicket where we can do that? Thank in advance. Our team. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Exceptions and Ajax Events
Hi there,Our team was discussing about if there is a place where all exceptions, that come from an ajax behaviour, can be catched. We want to do this because we strongly belive that exceptions should be catched in one place, but now we have to catch the exception in every ajax method( onSubmit, onChance, etc) in the application. Is there one place in wicket where we can do that? Thank in advance. Our team.
Re: Exceptions and Ajax Events
something like this in your application should work: @Override public RequestCycle newRequestCycle(Request request, Response response) { return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response) { @Override public Page onRuntimeException(Page page, RuntimeException e) { if (RequestCycle.get().getRequestTarget() instanceof AjaxRequestTarget) { // do something with ajax request targets } return super.onRuntimeException(page, e); } }; } -- Jeremy Thomerson http://www.wickettraining.com On Thu, Oct 1, 2009 at 1:59 PM, Nicolas Melendez nmelen...@getsense.com.arwrote: Hi there,Our team was discussing about if there is a place where all exceptions, that come from an ajax behaviour, can be catched. We want to do this because we strongly belive that exceptions should be catched in one place, but now we have to catch the exception in every ajax method( onSubmit, onChance, etc) in the application. Is there one place in wicket where we can do that? Thank in advance. Our team.
Re: Exceptions and Ajax Events
Hi: We found out we need something else. Is there a way we can access to the component asociated to the listener that was processing the event? (of course it only applies to ajax events), becase from onRuntimeException we ony have the Page. Thanks, Esteban Jeremy Thomerson escribió: something like this in your application should work: @Override public RequestCycle newRequestCycle(Request request, Response response) { return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response) { @Override public Page onRuntimeException(Page page, RuntimeException e) { if (RequestCycle.get().getRequestTarget() instanceof AjaxRequestTarget) { // do something with ajax request targets } return super.onRuntimeException(page, e); } }; } -- Jeremy Thomerson http://www.wickettraining.com On Thu, Oct 1, 2009 at 1:59 PM, Nicolas Melendez nmelen...@getsense.com.arwrote: Hi there,Our team was discussing about if there is a place where all exceptions, that come from an ajax behaviour, can be catched. We want to do this because we strongly belive that exceptions should be catched in one place, but now we have to catch the exception in every ajax method( onSubmit, onChance, etc) in the application. Is there one place in wicket where we can do that? Thank in advance. Our team. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org