geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sreepriya ramakrishnan <sreepriya_ramakrish...@yahoo.com>
Subject Re: Geronimo and Cookies-code snippet
Date Tue, 03 Oct 2006 18:03:49 GMT
  Cookie cookie = new Cookie("mycookie","test");
  cookie.setMaxAge(60);
 response.addCookie(cookie);

then:

Cookie cookie[]=request.getCookies()
;System.out.println("Here testign
this..."+cookie.length);
			for (int i=0;i<cookie.length;i++)
			{
				System.out.println("Here testign
"+cookie[i].getName());
				if(cookie[i].getName().equals("mycookie"))
				{
					System.out.println("cookie
present.."+cookie[i].getValue());
				}
			}

-Priya
--- Paul McMahan <paulmcmahan@gmail.com> wrote:

> There's no setting that I'm aware of to explicitly
> enable cookies.
> Can you paste the code snipplet where you set the
> cookie and the
> snipplet where you look for it in a subsequent
> request?
> 
> Paul
> 
> On 10/3/06, sreepriya ramakrishnan
> <sreepriya_ramakrishnan@yahoo.com> wrote:
> > Hi Paul,
> >
> > But when I do request.getCookies() and check the
> > length there is only one.
> > Is there some setting within Geronimo where I
> should
> > enable cookies?
> >
> > -Priya
> >
> > --- Paul McMahan <paulmcmahan@gmail.com> wrote:
> >
> > > The JSESSIONID cookie is used by the server to
> carry
> > > your session id
> > > and I would expect your cookie to be in the same
> > > batch. When you get
> > > the array of cookies from the request you should
> > > iterate until you
> > > find the correct one:
> > > Cookie[] cookies = request.getCookie();
> > > for (int i=0; i<cookies.length; i++) {
> > >   if (cookies[i].getName().equals("mycookie")) {
> > >      // this is yours
> > >   }
> > > }
> > >
> > > Hope this helps,
> > > Paul
> > >
> > > On 10/3/06, sreepriya ramakrishnan
> > > <sreepriya_ramakrishnan@yahoo.com> wrote:
> > > > HI all,
> > > >
> > > > I am trying to add my cookie to the response.
> > > >
> > > > eg Cookie cookie = new
> Cookie("mycookie","test");
> > > >
> > > > now when I look for the cookie again , the
> name
> > > seems
> > > > to be changed to JSESSIONID.
> > > >
> > > > Can some one point me as to what is happening
> > > here?
> > > >
> > > > -Priya
> > > >
> > > >
> __________________________________________________
> > > > Do You Yahoo!?
> > > > Tired of spam?  Yahoo! Mail has the best spam
> > > protection around
> > > > http://mail.yahoo.com
> > > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message