Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 29th, 2003, 04:56 AM
vivanov vivanov is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 vivanov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question cookie

if I define method:

public boolean putCookie(HttpServletRequest req, HttpServletResponse resp
, String name, String value
) {
Cookie c = new Cookie(name, value);
c.setMaxAge(3600);
c.setDomain("www.office.com");
resp.addCookie(c);
return true;
}

what must be method getCookie?

Reply With Quote
  #2  
Old January 29th, 2003, 03:55 PM
oscagne oscagne is offline
Java Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 5 oscagne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How about...

public String getCookie(HttpServletRequest req, String name){
Cookie [] cookies = req.getCookies();
for (int i=0;i<cookies.length;i++){
if (cookies[i].getName().equals(name)) return cookies[i].getValue();
}
return null;
}

Reply With Quote
  #3  
Old January 30th, 2003, 01:02 AM
vivanov vivanov is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 vivanov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This method will not find mine cookie in domain "www.office.com". How to me to set the domain for reception cookie?

Reply With Quote
  #4  
Old February 1st, 2003, 02:04 PM
oscagne oscagne is offline
Java Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 5 oscagne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Not sure about your question...can you be more specific. What I can tell you though is that the cookies have to be set on the same domain that you are reading them from or they will not be readable

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > cookie


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT