Details
Description
I have a subclass of org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable whose IDataProvider.iterator method indirectly calls CookieUtils.save. This causes the following stack trace:
Caused by: java.lang.ClassCastException: org.apache.wicket.ajax.AbstractAjaxResponse$AjaxResponse cannot be cast to org.apache.wicket.request.http.WebResponse
at org.apache.wicket.util.cookies.CookieUtils.getWebResponse(CookieUtils.java:354) ~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.util.cookies.CookieUtils.save(CookieUtils.java:297) ~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.util.cookies.CookieUtils.save(CookieUtils.java:184) ~[wicket-core-6.9.1.jar:6.9.1]
DataTable calls its data provider's iterator method during org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender. Apparently at this point the response isn't a WebResponse. Perhaps CookieUtils should be changed to work with a generic Response, using its getContainerResponse method.