Stöhr Miroslav RNDr. Ph.D. wrote:
> Vážení kolegové,
> 
> nevíte jak v servletu zjistit defaultní session timeout? Tj. hodnotu, která 
> je nastavena ve web.xml? Jde to vůbec?
> 
> Jde mi o to, že nevím jestli někdo přede mnou nezavolal na session metodu 
> setMaxInactiveInterval(int interval) s nějakou jinou hodnotou timeoutu a 
> chtěl bych se vrátit k defaultnímu nastavení. 
> 
> Díky za radu. Doufám že jsem to vysvětlil srozumitelně. 


Specifikace Servlet API 2.4 říká o timeoutech pouze toto:

In the HTTP protocol, there is no explicit termination signal when a client is
no longer active. This means that the only mechanism that can be used to
indicate when a client is no longer active is a timeout period.
The default timeout period for sessions is defined by the servlet container and
can be obtained via the getMaxInactiveInterval method of the HttpSession
interface. This timeout can be changed by the Developer using the
setMaxInactiveInterval method of the HttpSession interface. The timeout
periods used by these methods are defined in seconds. By definition, if the
timeout period for a session is set to -1, the session will never expire. The
session invalidation will not take effect until all servlets using that session
have exited the service method. Once the session invalidation is initiated, a
new request must not be able to see that session.

Javadoc k getMaxInactiveInterval povídá:

Returns the maximum time interval, in seconds, that the servlet container will
keep this session open between client accesses. After this interval, the servlet
container will invalidate the session. The maximum time interval can be set with
the setMaxInactiveInterval method. A negative time indicates the session should
never timeout.

Ty texty si IMHO odporují, protože pokud se default
hodnota dá zjistit voláním getMaxInactiveInterval(),
tak by ta stejná metoda nemohla zároveň poskytovat údaj
o aktuálně nastavené hodnotě.

Čili si myslím, že default hodnota se po změně nedá přes API zjistit.
Asi by to šlo parsováním web.xml, ale v něm hodnota být nemusí,
třeba TomCat ji má nastavenou v souboru conf/web.xml.

Makub


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: [EMAIL PROTECTED]
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Odpovedet emailem