Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5369

Can't set a cookie using CookieUtils during an ajax request due to java.lang.ClassCastException: org.apache.wicket.ajax.AbstractAjaxResponse$AjaxResponse cannot be cast to org.apache.wicket.request.http.WebResponse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 6.9.1
    • 6.12.0, 7.0.0-M1
    • None
    • None
    • Java 7, Servlet 2.5, Apache Tomcat 7.

    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.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            dgileadi David Gileadi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: