On 1/8/07, Loren Rosen <[EMAIL PROTECTED]> wrote:


I'm writing this up as a 'how-to' topic for the wiki, and I've got a few
questions.

First, assuming the addCookie call is inside something inheriting from
WebPage, it seems
you need to first call getWebRequestCycle in order to get the WebRequest
and
WebResponse:

   getWebRequestCycle().getWebResponse().addCookie(new Cookie("foo",
"bar"));

Or am I overlooking something?

Second, how would one do this from inside a Panel? You might try

  getWebPage().getWebRequestCycle().getWebResponse().addCookie(new
Cookie("foo", "bar"));

but getWebRequestCycle is protected.


both of these situatiosn are equivalent: a page is a component and so is a
panel.

((WebResponse)getRequestCycle().getResponse()).addCookie
or really from anywhere within a request
((WebResponse)RequestCycle().get.getResponse()).addCookie


Third, in another e-mail someone suggested


getWebRequestCycle().getWebResponse().getHttpServletResponse().addCookie(new
Cookie("foo", "bar"));


no difference, webresponse just passes the addcookie call to the
httpservletresponse

-igor


Loren


Scott Swank wrote:
>
> Thanks, I searched through the Wicket source until I found WebRequest
> & WebResponse.  Now I'm set...
>
> public void onClick() {
>   getWebResponse().addCookie(new Cookie("foo", "bar"));
>   setResponsePage(new CookiePage());
> }
>
> public CookiePage() {
>   String value = "";
>
>   for (Cookie c : getWebRequest().getCookies())
>     if (c.getName().equals("foo"))
>       value = c.getValue();
>
>   this.add(new Label("cookieInfo", value));
> }
>
> On 10/18/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
>> Depends on what exactly you want to do.
>> FormComponent.setPersisent(true) will "save" the forms value in a
>> cookie and load it into the same FormComponent when the user reloads
>> the page (login page: rememberMe). This approach doesnt require any
>> cookie knowledge from users. If you need some thing else than get the
>> servlet response object and handle the cookie yourself. No magic about
>> it.
>>
>> Juergen
>>
>> On 10/19/06, Scott Swank <[EMAIL PROTECTED]> wrote:
>> > I've searched the wiki & email list to no avail.  Does Wicket provide
>> > any APIs for manipulating cookies?
>> >
>> > Thanks once again.
>> >
>> >
>> > --
>> > Scott Swank
>> > reformed mathematician
>> >
>> >
>>
-------------------------------------------------------------------------
>> > Using Tomcat but need to do more? Need to support web services,
>> security?
>> > Get stuff done quickly with pre-integrated technology to make your
job
>> easier
>> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> >
>>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>>
>>
-------------------------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services,
security?
>> Get stuff done quickly with pre-integrated technology to make your job
>> easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
> --
> Scott Swank
> reformed mathematician
>
> Power is not a means, it is an end. One does not establish a
> dictatorship in order to safeguard a revolution; one makes the
> revolution in order to establish the dictatorship. The object of
> persecution is persecution. The object of torture is torture. The
> object of power is power.  -- George Orwell, 1984
>
>
-------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

--
View this message in context:
http://www.nabble.com/cookies-tf2471411.html#a8227281
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to