Return-Path: Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: (qmail 84186 invoked from network); 1 Feb 2011 09:47:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Feb 2011 09:47:11 -0000 Received: (qmail 26233 invoked by uid 500); 1 Feb 2011 09:47:10 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 25911 invoked by uid 500); 1 Feb 2011 09:47:08 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 25903 invoked by uid 99); 1 Feb 2011 09:47:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Feb 2011 09:47:07 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [88.80.164.193] (HELO ir.gameop.net) (88.80.164.193) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Feb 2011 09:47:00 +0000 X-IronPort-AV: E=Sophos;i="4.60,409,1291590000"; d="scan'208";a="13979493" Received: from unknown (HELO CAS01.ongame.com) ([192.168.1.232]) by iradmin01.ongame.com with ESMTP; 01 Feb 2011 10:53:03 +0100 Received: from [192.168.11.50] (192.168.11.50) by CAS01.ongame.com (192.168.1.230) with Microsoft SMTP Server (TLS) id 8.2.255.0; Tue, 1 Feb 2011 10:46:37 +0100 Message-ID: <4D47D67C.8010909@bwin.org> Date: Tue, 1 Feb 2011 10:46:36 +0100 From: =?ISO-8859-1?Q?Robert_Dahlstr=F6m?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: users@wicket.apache.org Subject: Wickettester, cookies and redirects in Wicket 1.4.15 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Hi, I currently have an application reading a cookie in my session. All of my unit tests where the pattern is: Create page -> submit form -> redirect to new page fails to read this cookie after the redirect to new page. The cookie is added both to the response and request before each new test (WicketTester gets recreated): tester.getWicketResponse().addCookie(cookie); tester.getServletRequest().setCookies(new Cookie[]{cookie}); This works fine during first page rendering and form submission. But after the form has been submitted and the redirect to new page takes place the cookie does not exist in the new request. Since I'm a bit unsure if this is the wanted behavior for WicketTester or not I'm posting this to all users out there. In my particular use case I would like the cookie to be persisted between original request and new request since that's how it is working in the real application. Codewise (with Wicket 1.4.15): In MockWebApplication.postProcessRequestCycle: if (httpResponse.isRedirect()) { lastRenderedPage = generateLastRenderedPage(cycle); MockHttpServletRequest newHttpRequest = new MockHttpServletRequest(application, servletSession, application.getServletContext()); ... } The call to new MockHttpServletRequest will clear all cookies set during initialize() and thus my cookie will not be set in the redirect request. Any ideas on how to tackle this? For me I'd like the WicketTester to copy any existing cookies from the original request to the redirect request. I'd also be happy if there's another place in the code where I can set the cookie to have it available during the redirect request phase as well. I also found an old bug (WICKET-1886) that felt like the same issue when I read it. Regards Robert --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org