You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Piotr Hołubowicz <pi...@man.poznan.pl> on 2011/12/19 14:21:07 UTC

Re: unit testing cookies after redirect

Hi,

Have you verified that the cookie value is correct? In Cookie javadocs [1]
it reads: "With Version 0 cookies, values should not contain white space,
brackets, parentheses, equals signs, commas, double quotes, slashes,
question marks, at signs, colons, and semicolons. Empty values may not
behave the same way on all browsers. "

I've had a similar issue to yours and it turned out that the value I was
setting contained a semicolon, so setting the cookie always failed silently.

best,
Piotr


[1] 
http://docs.oracle.com/javaee/6/api/javax/servlet/http/Cookie.html#setValue(java.lang.String)
http://docs.oracle.com/javaee/6/api/javax/servlet/http/Cookie.html#setValue(java.lang.String) 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/unit-testing-cookies-after-redirect-tp3995764p4214036.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: unit testing cookies after redirect

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Dec 30, 2011 at 2:02 PM, kamiseq <ka...@gmail.com> wrote:
> hej,
> SO it seems that errors I got was because of my bad testing.
>
> I created simple test in new project and it now works.
>
>  the only problem is that
> 1. wicket tester process request twice after startPage - the first
> time the page is rendered and cookies are saved into AddCookieAction.
> then request is processed second time and this time all actions are
> invoked and cookie is finally added to second response. Is this
> because wicket is always redirecting browser with "render" request??
> 2. after request is fully processed the original request and response
> are saved as lastRequest and lastResonse (llok at
> recordRequestResponse in WicketBaseTester). cookies are in
> tester.getLastResponse().getCookies()
> 3. the thing which is not intuitive is the fact that after one request
> is fully processed the new request (and response) is created but
> cookies from last response are not rewritten to it. cookies will be
> added when new request will be processed by tester on next startPage.

this is fixed in 1.5-snapshot

>
> I think that's it, hope I got this right this time ;] and it may help someone
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: unit testing cookies after redirect

Posted by kamiseq <ka...@gmail.com>.
hej,
SO it seems that errors I got was because of my bad testing.

I created simple test in new project and it now works.

 the only problem is that
1. wicket tester process request twice after startPage - the first
time the page is rendered and cookies are saved into AddCookieAction.
then request is processed second time and this time all actions are
invoked and cookie is finally added to second response. Is this
because wicket is always redirecting browser with "render" request??
2. after request is fully processed the original request and response
are saved as lastRequest and lastResonse (llok at
recordRequestResponse in WicketBaseTester). cookies are in
tester.getLastResponse().getCookies()
3. the thing which is not intuitive is the fact that after one request
is fully processed the new request (and response) is created but
cookies from last response are not rewritten to it. cookies will be
added when new request will be processed by tester on next startPage.

I think that's it, hope I got this right this time ;] and it may help someone

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: unit testing cookies after redirect

Posted by kamiseq <ka...@gmail.com>.
sorry not yet, december turned out to be very busy for me ;/ I hope to
reproduce all errors I had with simple maven startup project. I ll
post something as soon as possible.

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org