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

org/apache/wicket/util/tester/BaseWicketTester.java add cookie twice

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.5-RC1
    • 1.5-RC2
    • wicket
    • None
    • all

    Description

      Consider the clearCookie method.
      The WicketTesterServletWebResponse clearCookie calls the
      super class (ServletWebResponse) clearCookie method which
      (amoung other things) calls the addCookie method.
      Because of polymorphism, this calls the WicketTesterServletWebResponse
      addCookie which adds the cookie to the cookies List.
      Then the WicketTesterServletWebResponse clearCookie
      method adds the cookie a second time to the cookies List.

      Unless it is useful to have the same cookie in the List
      more than once, the List could be a Set.

      private static class WicketTesterServletWebResponse
      extends ServletWebResponse
      mplements IMetaDataBufferingWebResponse {
      ...
      @Override
      public void addCookie(Cookie cookie)

      { super.addCookie(cookie); cookies.add(cookie); }


      @Override
      public void clearCookie(Cookie cookie)

      { super.clearCookie(cookie); cookies.add(cookie); }


      ...
      }
      public class ServletWebResponse extends WebResponse {
      ...
      @Override
      public void addCookie(Cookie cookie)

      { httpServletResponse.addCookie(cookie); }

      @Override
      public void clearCookie(Cookie cookie)

      { cookie.setMaxAge(0); cookie.setValue(null); addCookie(cookie); }

      ...
      }

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            emberson Richard Emberson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: