Top Description Fields Constructors Methods
org.apache.catalina.manager.util

public Class SessionUtils

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, java.security.Principal, java.util.ArrayList, .Enumeration, .List, .Locale, javax.security.auth.Subject, jakarta.servlet.http.HttpSession, org.apache.catalina.Session, org.apache.tomcat.util.ExceptionUtils

Utility methods on HttpSessions.
Author
Cédrik LIME

Field Summary

Modifier and TypeField and Description
private static final String
private static final String[]
LOCALE_TEST_ATTRIBUTES

Lower and upper-case strings will be dynamically generated.

private static final String
private static final String
STRUTS_LOCALE_KEY

The session attributes key under which the user's selected java.util.Locale is stored, if any.

private static final String[]
USER_TEST_ATTRIBUTES

For efficient operation, list the attributes here with the typically used capitalisation.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static long
public static long
public static long
public static Locale

Returns:

the locale
guessLocaleFromSession
(final Session
The session
in_session
)

Try to get user locale from the session, if possible.

public static Locale
public static Object

Returns:

the user
guessUserFromSession
(final Session
The session
in_session
)

Try to get user from the session, if possible.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JSTL_LOCALE_KEYback to summary
private static final String JSTL_LOCALE_KEY
LOCALE_TEST_ATTRIBUTESback to summary
private static final String[] LOCALE_TEST_ATTRIBUTES

Lower and upper-case strings will be dynamically generated. Put mid-capitalised strings here!

SPRING_LOCALE_KEYback to summary
private static final String SPRING_LOCALE_KEY
STRUTS_LOCALE_KEYback to summary
private static final String STRUTS_LOCALE_KEY

The session attributes key under which the user's selected java.util.Locale is stored, if any.

USER_TEST_ATTRIBUTESback to summary
private static final String[] USER_TEST_ATTRIBUTES

For efficient operation, list the attributes here with the typically used capitalisation. This will be tried first and then the auto-generated upper and lower case versions will be tried.

Constructor Detail

SessionUtilsback to summary
private SessionUtils()

Method Detail

getInactiveTimeForSessionback to summary
public static long getInactiveTimeForSession(Session in_session)
getTTLForSessionback to summary
public static long getTTLForSession(Session in_session)
getUsedTimeForSessionback to summary
public static long getUsedTimeForSession(Session in_session)
guessLocaleFromSessionback to summary
public static Locale guessLocaleFromSession(final Session in_session)

Try to get user locale from the session, if possible.

Implementation Note

this method has explicit support for Tapestry 3, Struts 1.x and Spring JSF check the browser meta tag "accept languages" to choose what language to display.

Parameters
in_session:Session

The session

Returns:Locale

the locale

guessLocaleFromSessionback to summary
public static Locale guessLocaleFromSession(final HttpSession in_session)
guessUserFromSessionback to summary
public static Object guessUserFromSession(final Session in_session)

Try to get user from the session, if possible.

Parameters
in_session:Session

The session

Returns:Object

the user