On Wed, Apr 24, 2013 at 6:12 PM, Michael Mosmann <mich...@mosmann.de> wrote:
> Am 24.04.2013 13:59, schrieb Martin Grigorov: > >> Hi, >> >> On Tue, Apr 23, 2013 at 10:58 AM, Michael Mosmann <mich...@mosmann.de >> >wrote: >> >> Hi, >>> >>> as someone may has noticed there is a bug in the WicketTester cookie >>> handling ( >>> https://issues.apache.org/****jira/browse/WICKET-5147<https://issues.apache.org/**jira/browse/WICKET-5147> >>> <https:**//issues.apache.org/jira/**browse/WICKET-5147<https://issues.apache.org/jira/browse/WICKET-5147> >>> >). >>> >>> I wrote some tests to make things clear, but in a talk with Martin we >>> got a >>> little bit suspicious about the way WicketTester should handle this. >>> >>> Two scenarios are possible (or more?): >>> >>> 1. remember cookies from server, forget cookies from client: >>> - you can set any cookies you like in tester.getRequest() >>> - any cookies from request are send to the page >>> - you can set any cookies you like in the response >>> - after the response is done, every cookie set by the server is >>> remembered >>> for further requests >>> - if you add new cookies to tester.getRequest() they can overwrite any >>> remembered response cookies >>> - the cookies set in an old request are not copied into new requests >>> >>> 2. remember cookies from server and from client: >>> - you can set any cookies you like in tester.getRequest() >>> - any cookies from request are send to the page >>> - you can set any cookies you like in the response >>> - after the response is done, every cookie set by the server and from the >>> last request is set to the new request >>> - you will see all cookies in tester.getRequest() and can change these >>> before the next request is started >>> >>> What do you think? >>> >>> I think the second is the correct one. >> An application can use JavaScript to create a cookie. This cookie will be >> sent to the server until it expires or the server sends back a cookie with >> the same name and max-age=0 to delete it. >> So I think any cookie added to a request with >> tester.getRequest().addCookie(**cookie) should be send with any following >> request until either the cookie is removed (age=0) or the tester is >> destroyed (browser close). >> > bwt: there is no code for this cookie is expired stuff.. will write a test > for this.. :) > org.apache.wicket.util.tester.BaseWicketTester#transferRequestCookies() has logic to remove cookies with age=0 It may need to be extended though > >> >> -- >>> Michael Mosmann >>> >>> >>> >> > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>