Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 68875 invoked from network); 24 Nov 2003 19:52:42 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 24 Nov 2003 19:52:42 -0000 Received: (qmail 86796 invoked by uid 500); 24 Nov 2003 19:52:13 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 86667 invoked by uid 500); 24 Nov 2003 19:52:12 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 86654 invoked from network); 24 Nov 2003 19:52:11 -0000 Received: from unknown (HELO loif) (217.126.142.208) by daedalus.apache.org with SMTP; 24 Nov 2003 19:52:11 -0000 Received: from loif ([127.0.0.1] helo=terra.es ident=fiol) by loif with esmtp (Exim 3.36 #1 (Debian)) id 1AOMkp-0001vI-00 for ; Mon, 24 Nov 2003 20:52:15 +0100 Message-ID: <3FC2616D.8060607@terra.es> Date: Mon, 24 Nov 2003 20:52:13 +0100 From: =?ISO-8859-1?Q?Antonio_Fiol_Bonn=EDn?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031107 Debian/1.5-3 X-Accept-Language: es-es, es, fr-fr, fr, en-gb, en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: how to customize HTTPSession References: <5BD6A7D6.1FB5973F.1038D0FA@netscape.net> In-Reply-To: <5BD6A7D6.1FB5973F.1038D0FA@netscape.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Please remember that you can only add cookies to the response BEFORE committing the response. That means, if you do write a (big) part of the result and Tomcat starts sending it to the browser, you will not be able to set any more cookies (or will not be sent to the browser anyway). Yours, Antonio Fiol ppalavilli@netscape.net wrote: >Hi, > >I am new to the java webapp development. I want to store some user data for my app in a client side cookie rather than as a server side object and referencing it with a sessionId. One of the main reasons for that is - we will be running multiple servers load balancing. Since the HTTPSessions are java container instance specific - I don't want to use them. I have read about distributed Session support - but it does involve complicated setup and seems to be a overkill when compared to the data that I want to store. > >Anyway - in that aspect - I have these 2 questions : > >1. Is there a way to override the HTTPSession and HTTPResponse provided by tomcat to save the contents of the Session as a cookie instead of just storing the sessionId ? > >2. If I implement my own Session class, and store it as a attribute in the HTTPRequest object, how can I write the contents of the session as a cookie right before I return the response ? The way I used to do it in other apps in C++ is to write a destructor for my session object, which will get called when the request is being terminated and I could write the cookie in the response. But the java equivalent to destructor "finalize()" is not gauranteed to be called until the GC wakes up. So how can I make sure I set the cookie after the request is completely processed? > >Please pardon my ignorance if made any wrong assumptions. >I would appreciate any help. >regards, >Praveen > >__________________________________________________________________ >McAfee VirusScan Online from the Netscape Network. >Comprehensive protection for your entire computer. Get your free trial today! >http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 > >Get AOL Instant Messenger 5.1 free of charge. Download Now! >http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org