You're right that we'll never have an HTTP request, so I can see why you're confused 
as to why we'd want a session. The reason is for performance. We want to avoid the 
overhead of writing and reading a database. This is very short term information, but 
now that we're needing to run in a load-balanced cluster, we need to be able to handle 
the situation where requests could, in the worst case scenario, come into each server 
alternatively. IBM's WebSphere App. Server when running in a cluster will propogate 
the session to any server that needs it. Thus if we use a session, it'll propogate 
back and forth between the boxes.

Simon

>-----Original Message-----
>From: Jarnot Voytek Contr AU HQ/SC 
>[mailto:[EMAIL PROTECTED]
>Sent: Thursday, October 16, 2003 11:47 AM
>To: 'Struts Users Mailing List'
>Subject: RE: [Semi OT] When does a servlet get a session?
>
>
>If your servlet never services http requests, how is an http 
>session useful?
>You can only access the session through a request - which 
>you'll never have.
>
>Would the servlet context work?  getServletContext().setAttribute(...)
>
>--
>Voytek Jarnot
>Quantum materiae materietur marmota monax si marmota monax 
>materiam possit
>materiari?
>
>
>> -----Original Message-----
>> From: Chappell, Simon P [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, October 16, 2003 11:40 AM
>> To: Struts Mailing List (E-mail)
>> Subject: [Semi OT] When does a servlet get a session?
>> 
>> 
>> OK, I have a servlet running alongside my Struts application 
>> and it is basically used to start (from the init() method) a 
>> separate network listener for handling network requests from 
>> a number of PLC units that are incapable of generating HTTP 
>> traffic, only straight socket connections, blasting a wierd 
>> protocol called DF1 and then waiting for a reply.
>> 
>> We have all of that working. But now we want to store a piece 
>> of information in the servlet session so that we can 
>> load-balance on a WAS cluster. When we call back into the 
>> servlet to store the information, our session information is null.
>> 
>> My question is ... when does a servlet get a session and can 
>> we force one from the init method? This servlet never gets 
>> called, so we never have an HttpSession. Can we force it to 
>> create an HttpSession?
>> 
>> Simon
>> 
>> -----------------------------------------------------------------
>> Simon P. Chappell                     [EMAIL PROTECTED]
>> Java Programming Specialist                      www.landsend.com
>> Lands' End, Inc.                                   (608) 935-4526
>> 
>> "Never give in - never, never, never, never, in nothing great or
>> small, large or petty, never give in except to convictions of
>> honor and good sense." - Sir Winston Churchill
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to