use of org.glassfish.web.config.serverbeans.SessionProperties in project Payara by payara.
the class BasePersistenceStrategyBuilder method readInstanceLevelParams.
public void readInstanceLevelParams(ServerConfigLookup serverConfigLookup) {
org.glassfish.web.config.serverbeans.SessionManager smBean = serverConfigLookup.getInstanceSessionManager();
if (smBean != null) {
// The persistence-type controls what properties of the
// session manager can be configured
org.glassfish.web.config.serverbeans.ManagerProperties mgrBean = smBean.getManagerProperties();
if (mgrBean != null) {
// manager reap-interval-in-seconds
String reapIntervalInSecondsString = mgrBean.getReapIntervalInSeconds();
if (reapIntervalInSecondsString != null) {
try {
reapInterval = Integer.parseInt(reapIntervalInSecondsString);
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.MANAGER_REAP_INTERVAL_SET, reapInterval);
}
} catch (NumberFormatException e) {
// XXX need error message
}
} else {
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.NO_INSTANCE_LEVEL_VALUE_SET_MGR_REAP_INTERVAL);
}
}
// max-sessions
String maxSessionsString = mgrBean.getMaxSessions();
if (maxSessionsString != null) {
try {
maxSessions = Integer.parseInt(maxSessionsString);
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.MAX_SESSIONS_SET, maxSessions);
}
} catch (NumberFormatException e) {
// XXX need error message
}
} else {
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.NO_INSTANCE_LEVEL_VALUE_SET_MAX_SESSIONS);
}
}
// session-file-name
String sessionFilenameString = mgrBean.getSessionFileName();
if (sessionFilenameString != null) {
sessionFilename = sessionFilenameString;
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.SESSION_FILENAME_SET, sessionFilename);
}
}
// START CR 6275709
sessionIdGeneratorClassname = mgrBean.getSessionIdGeneratorClassname();
if (sessionIdGeneratorClassname != null && _logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.SESSION_ID_GENERATOR_CLASSNAME_SET, sessionIdGeneratorClassname);
}
// END CR 6275709
// Now do properties under <manager-properties> element
List<Property> props = mgrBean.getProperty();
if (props != null) {
for (Property prop : props) {
String name = prop.getName();
String value = prop.getValue();
// maxIdleBackupSeconds
if (name.equalsIgnoreCase("maxIdleBackupSeconds")) {
try {
maxIdleBackup = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
} else if (name.equalsIgnoreCase(MIN_IDLE_SWAP_PROPERTY)) {
try {
minIdleSwap = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
} else if (name.equalsIgnoreCase(MAX_IDLE_SWAP_PROPERTY)) {
try {
maxIdleSwap = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
}
}
}
}
org.glassfish.web.config.serverbeans.StoreProperties storeBean = smBean.getStoreProperties();
if (storeBean != null) {
// Store reap-interval-in-seconds
String reapIntervalInSecondsString = storeBean.getReapIntervalInSeconds();
if (reapIntervalInSecondsString != null) {
try {
storeReapInterval = Integer.parseInt(reapIntervalInSecondsString);
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.STORE_REAP_INTERVAL_SET, storeReapInterval);
}
} catch (NumberFormatException e) {
// XXX need error message
}
}
// Directory
String directoryString = storeBean.getDirectory();
if (directoryString != null) {
directory = directoryString;
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.DIRECTORY_SET, directoryString);
}
}
}
}
SessionProperties spBean = serverConfigLookup.getInstanceSessionProperties();
if (spBean != null) {
// session timeout-in-seconds
String timeoutSecondsString = spBean.getTimeoutInSeconds();
if (timeoutSecondsString != null) {
try {
sessionMaxInactiveInterval = Integer.parseInt(timeoutSecondsString);
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.SESSION_MAX_INACTIVE_INTERVAL_SET, sessionMaxInactiveInterval);
}
} catch (NumberFormatException e) {
// XXX need error message
}
} else {
if (_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST, LogFacade.NO_INSTANCE_LEVEL_VALUE_SET_SESSION_MAX_INACTIVE_INTERVAL);
}
}
}
}
use of org.glassfish.web.config.serverbeans.SessionProperties in project Payara by payara.
the class WebContainer method initInstanceSessionProperties.
/**
* Initializes the instance-level session properties (read from config.web-container.session-config.session-properties
* in domain.xml).
*/
private void initInstanceSessionProperties() {
SessionProperties spBean = serverConfigLookup.getInstanceSessionProperties();
if (spBean == null || spBean.getProperty() == null) {
return;
}
List<Property> props = spBean.getProperty();
if (props == null) {
return;
}
for (Property prop : props) {
String propName = prop.getName();
String propValue = prop.getValue();
if (propName == null || propValue == null) {
throw new IllegalArgumentException(rb.getString(LogFacade.NULL_WEB_PROPERTY));
}
if (propName.equalsIgnoreCase("enableCookies")) {
instanceEnableCookies = ConfigBeansUtilities.toBoolean(propValue);
} else if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, LogFacade.PROPERTY_NOT_YET_SUPPORTED, propName);
}
}
}
Aggregations