You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2010/11/14 10:48:07 UTC
svn commit: r1034967 -
/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java
Author: mgrigorov
Date: Sun Nov 14 09:48:07 2010
New Revision: 1034967
URL: http://svn.apache.org/viewvc?rev=1034967&view=rev
Log:
Set the proper exception setting before clicking any of the "ajax failure links"
This way the example shows the correct behavior for the links.
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java
Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java?rev=1034967&r1=1034966&r2=1034967&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java Sun Nov 14 09:48:07 2010
@@ -25,6 +25,7 @@ import org.apache.wicket.ajax.markup.htm
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.settings.IExceptionSettings.AjaxErrorStrategy;
/**
@@ -163,6 +164,12 @@ public class LinksPage extends BasePage
@Override
public void onClick(AjaxRequestTarget target)
{
+ // Set the proper setting to execute ajax failure handler
+ // note: will be set until the "exception" link is clicked or the application is
+ // restarted
+ getApplication().getExceptionSettings().setAjaxErrorHandlingStrategy(
+ AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);
+
throw new WicketRuntimeException("Failure link clicked");
}
@@ -206,6 +213,12 @@ public class LinksPage extends BasePage
@Override
public void onClick(AjaxRequestTarget target)
{
+ // Set the proper setting to show the error page
+ // note: will be set until the "failure" link is clicked or the application is
+ // restarted
+ getApplication().getExceptionSettings().setAjaxErrorHandlingStrategy(
+ AjaxErrorStrategy.REDIRECT_TO_ERROR_PAGE);
+
throw new RuntimeException("test whether the exception handling works");
}
});