- From: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
- Date: Tue, 24 Nov 1998 09:44:40 +0100
- To: Rajesh Joshi <rjoshi@arsin.com>
- cc: "'www-jigsaw@w3.org'" <www-jigsaw@w3.org>
It's a known bug that has been fixed. You can get an updated version of the servlet package in the W3C CVS public tree [1]. [1] http://dev.w3.org/cgi-bin/cvsweb/ http://dev.w3.org/cgi-bin/cvsweb/java/classes/org/w3c/jigsaw/servlet/ Regards, Benoit. Rajesh Joshi writes: > Hi, > > I am trying to set cookie in response header & then read the same information > in another > servlet. Sample code for setting is : > > Cookie c = new Cookie("Test", "yes"); > c.setDomain("."+req.getServerName()); > System.out.println("Server Name: " + req.getServerName()); > c.setMaxAge(100000); > res.addCookie(c); > > When I try to read the same, in the following piece of code: > > Cookie cookies[] = null; > boolean rv = false; > String strValue = new String(); > > System.out.println("readCookies"); > try{ > try { > > cookies = req.getCookies(); > System.out.println(cookies); > } > catch (NullPointerException e) > { > System.out.println("Cookie Servlet::ReadCookie failed"); > return rv; > } > > if(cookies != null){ > for(int i=0; i < cookies.length; i++){ > Cookie thisCookie = cookies[i]; > System.out.println("Cookie Server : " +thisCookie.getDomain() > ); > String strCookieInfo = thisCookie.getName(); > System.out.println(strCookieInfo); > > if (strCookieInfo.equals("Test")) { > strValue = thisCookie.getValue(); > System.out.println("Cookie UID : " + strValue); > rv = true; > } > > The get the "Null pointer exception" with message "Cookie Servlet::ReadCookie > failed." > The cookie.txt shows no entry for the cookie. > > Regards, > > Rajesh Joshi > Arsin Corporation. > > - Benoît Mahé ------------------------------------------------------- World Wide Web Consortium (W3C) Architecture domain - Jigsaw Team http://www.w3.org/People/Mahe - bmahe@w3.org - +33.4.92.38.79.89 ---------------------------------------------------------------------
Received on Tuesday, 24 November 1998 03:44:46 UTC