🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #390

Re: Cookies on client

#390
From: Paul Furbacher TeamB
Date: Tue, 28 Oct 2003 22:29
44 lines
2361 bytes
In <3f9cd4b8@newsgroups.borland.com> Peter Th?nell wrote:
>  
>  How do I (using URLConnection etc.) obtain and send cookies?
>  
>  Also, how does one distinguish between session and persistent cookies?

A Google search of

  URLConnection cookies

yields a number of hits.  Here's just one:

  http://www.hccp.org/java-net-cookie-how-to.html

Assuming you are talking about communicating
between a client application and a Web server, 
here are some thoughts:

Since there's no definition of what a session is
with a URLConnection approach to communicating 
with a server, you'll have to determine what's
a session and when a cookie is invalid.  Both
sides of your application (client and server side)
will have to have logic to handle this.

The Cookie class has get/setMaxAge() which can be 
used to set and determine whether the cookie is
expired.  Your client app will have to ask "getMaxAge()"
and decide when to dispose of it.  You could follow
the convention that 0 (zero) mean expire now, -1
means expire when the client exits, and so on.


Paul Furbacher [TeamB]

  Save time, search the archives:
       http://info.borland.com/newsgroups/ngsearch.html
       
  Is it in Joi Ellis's Faq-O-Matic? 
       http://www.visi.com/~gyles19/fom-serve/cache/1.html
 
  Finally, please send responses to the newsgroup only.
  That means, do not send email directly to me.
  Thank you.
Technical Details
Message-ID: <20031028182853965-0500@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f9cd4b8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,cfa4aa5d297d4fc3
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2003-10-28 15:36:12 PST
User-Agent: Halime (MacOSX)/1.0rc2b
Newsgroups: borland.public.jbuilder.java.api
Message-ID: <20031028182853965-0500@newsgroups.borland.com>
References:  <3f9cd4b8@newsgroups.borland.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Subject: Re: Cookies on client
From: Paul Furbacher [TeamB] <pfurbacher@mac.com>
Organization: Reverse Alchemy, Inc.
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 68.39.103.120
Date: 28 Oct 2003 15:29:07 -0700
X-Trace: newsgroups.borland.com 1067383747 68.39.103.120 (28 Oct 2003 15:29:07 -0700)
Lines: 44
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail