The session id needs to be generated by the client NOT the server and sent to the server by the client with every request. In this manner the server is able to identify all the requets as coming from the same client and hence can then maintain a session "state" object for each client separately.
So to answer your questions, getSessions is a method you call in the server, and I don't think it creates session id's, it just tells you what was given to it by the client in the last request. So in your CLIENT app (NOT the server) you must create a session id, it does not matter how, use the math lib's random methods and perhaps the system clock or whatever turns you on. Just make sure that you send it to the SERVER from the CLIENT every time you make a request. To answer your second question, I do not think it is neccessary to send it back to your client app as long as you store the original session id in your client app and send it to the SERVER from the CLIENT every time you make a request (this is the key bit which is why I have mentioned it 3 times). One more caveat, I have not done this myself, this is all just speculation based on what I know of how HTTP works. Good luck, you are on your own from here, if you get it right please post back to the list and tell us how you managed to do it. > -----Original Message----- > From: randie ursal [SMTP:[EMAIL PROTECTED]] > Sent: 03 February 2003 12:08 > To: [EMAIL PROTECTED] > Subject: Re: HttpClient to Servlet > > sorry wrong grammar. =) > > can i make use of the sessionid created during 'getSession(true)'? DOES > this sessionid be included in the response of the servlet to the > HttpClient? how do i get this sessionid? > > > randie ursal wrote: > > can i make use of the sessionid created during 'getSession(true)'? thus > > this sessionid be included in the response of the servlet to the > > HttpClient? how do i get this sessionid? > > > > thanks a lot in advance. > > > > Adrian Janssen wrote: > > > >> I don't know in practise how to do this but in principle what you need > >> to do > >> is send a cookie with the same session id with evey request, this > >> means you > >> need to set a header variable using the following method of > >> URLConnection: > >> > >> public void setRequestProperty(String key, String value) > >> > >> I am not quite sure what the key should be, try "sessionid" for > starters > >> though. The value can be anything, as long as it consistent accross > your > >> calls. The value should be inscrutably random for security purposes > >> though. > >> > >> Hopefully someone else can elaborate on this. > >> > >> Cheers > >> Adrian > >> > >> > >>> -----Original Message----- > >>> From: randie ursal [SMTP:[EMAIL PROTECTED]] > >>> Sent: 03 February 2003 11:08 > >>> To: [EMAIL PROTECTED] > >>> Subject: HttpClient to Servlet > >>> > >>> hi, > >>> > >>> When i try to access my servlet from a Java Application using > >>> URLConnection, every request was considered as a new HttpSession. I > was > >>> able to check this using the 'getSession(false)' and it result to not > >>> NULL which means that a new HttpSession was created. How can i > implement > >>> my Java application so that when it request, my Servlet would not > create > >>> a new HttpSession object. > >>> > >>> > >>> thanks. > >>> > >>> randie > >>> > >>> > ========================================================================== > >>> > >>> = > >>> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > >>> JSP-INTEREST". > >>> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > >>> DIGEST". > >>> > >>> Some relevant archives, FAQs and Forums on JSPs can be found at: > >>> > >>> http://java.sun.com/products/jsp > >>> http://archives.java.sun.com/jsp-interest.html > >>> http://forums.java.sun.com > >>> http://www.jspinsider.com > >> > >> > >> -- > >> > >> It is the strict policy of Truworths that its e-mail facility and all > >> e-mail communications emanating therefrom, should be utilised for > >> business purposes only and should conform to high professional and > >> business standards. Truworths has stipulated certain regulations in > >> terms whereof strict guidelines relating to the use and content of > >> e-mail communications are laid down. The use of the Truworths e-mail > >> facility is not permitted for the distribution of chain letters or > >> offensive mail of any nature whatsoever. Truworths hereby distances > >> itself from and accepts no liability in respect of the unauthorised > >> use of its e-mail facility or the sending of e-mail communications > >> for other than strictly business purposes. Truworths furthermore > >> disclaims liability for any unauthorised instruction for which > >> permission was not granted. Truworths Limited accepts no liability > >> for any consequences arising from or as a result of reliance on this > >> message unless it is in respect of bona fide Truworths business for > >> which proper authorisation has been granted. > >> > >> Any recipient of an unacceptable communication, a chain letter or > >> offensive material of any nature is requested to notify the Truworths > >> e-mail administrator ([EMAIL PROTECTED]) immediately in order that > >> appropriate action can be taken against the individual concerned. > >> > >> > ========================================================================== > = > >> > >> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > >> JSP-INTEREST". > >> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > >> DIGEST". > >> > >> Some relevant archives, FAQs and Forums on JSPs can be found at: > >> > >> http://java.sun.com/products/jsp > >> http://archives.java.sun.com/jsp-interest.html > >> http://forums.java.sun.com > >> http://www.jspinsider.com > >> > >> > > > > -- > > > > Randie V. Ursal > > Design Engineering Department > > NEC Telecom Software Philippines, Inc. > > office : +63(032) 233-9142 (loc.3119) > > mobile : +63(0917) 467-8244 > > email : [EMAIL PROTECTED] > > > > > ========================================================================== > = > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > > JSP-INTEREST". > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > > DIGEST". > > > > Some relevant archives, FAQs and Forums on JSPs can be found at: > > > > http://java.sun.com/products/jsp > > http://archives.java.sun.com/jsp-interest.html > > http://forums.java.sun.com > > http://www.jspinsider.com > > > > > > ========================================================================== > = > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > > Some relevant archives, FAQs and Forums on JSPs can be found at: > > http://java.sun.com/products/jsp > http://archives.java.sun.com/jsp-interest.html > http://forums.java.sun.com > http://www.jspinsider.com -- It is the strict policy of Truworths that its e-mail facility and all e-mail communications emanating therefrom, should be utilised for business purposes only and should conform to high professional and business standards. Truworths has stipulated certain regulations in terms whereof strict guidelines relating to the use and content of e-mail communications are laid down. The use of the Truworths e-mail facility is not permitted for the distribution of chain letters or offensive mail of any nature whatsoever. Truworths hereby distances itself from and accepts no liability in respect of the unauthorised use of its e-mail facility or the sending of e-mail communications for other than strictly business purposes. Truworths furthermore disclaims liability for any unauthorised instruction for which permission was not granted. Truworths Limited accepts no liability for any consequences arising from or as a result of reliance on this message unless it is in respect of bona fide Truworths business for which proper authorisation has been granted. Any recipient of an unacceptable communication, a chain letter or offensive material of any nature is requested to notify the Truworths e-mail administrator ([EMAIL PROTECTED]) immediately in order that appropriate action can be taken against the individual concerned. =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com