public Object getDescriptor() {
return null;
}
public Node writeDescriptor(Element root, WebBundleDescriptor webBundleDescriptor) {
SessionConfig sessionConfig = webBundleDescriptor.getSessionConfig();
com.sun.enterprise.deployment.runtime.web.SessionConfig runtimeSessionConfig =
webBundleDescriptor.getSunDescriptor().getSessionConfig();
Node scNode = null;
if (sessionConfig != null || runtimeSessionConfig != null) {
scNode = appendChild(root, RuntimeTagNames.SESSION_DESCRIPTOR);
}
if (runtimeSessionConfig != null) {
// timeout-secs
SessionProperties sessionProperties = runtimeSessionConfig.getSessionProperties();
if (sessionProperties != null && sessionProperties.sizeWebProperty() > 0) {
for (WebProperty prop : sessionProperties.getWebProperty()) {
String name = prop.getAttributeValue(WebProperty.NAME);
String value = prop.getAttributeValue(WebProperty.VALUE);
if (TIMEOUT_SECONDS.equals(name)) {
appendTextChild(scNode, RuntimeTagNames.TIMEOUT_SECS, value);
break;
}
}
}
// invalidation-interval-secs, max-in-memory-sessions
SessionManager sessionManager = runtimeSessionConfig.getSessionManager();
if (sessionManager != null) {
ManagerProperties managerProperties = sessionManager.getManagerProperties();
if (managerProperties != null && managerProperties.sizeWebProperty() > 0) {
for (WebProperty prop : managerProperties.getWebProperty()) {
String name = prop.getAttributeValue(WebProperty.NAME);
String value = prop.getAttributeValue(WebProperty.VALUE);
if (name.equals(REAP_INTERVAL_SECONDS)) {
appendTextChild(scNode,
RuntimeTagNames.INVALIDATION_INTERVAL_SECS, value);
} else if (name.equals(MAX_SESSIONS)) {
appendTextChild(scNode,
RuntimeTagNames.MAX_IN_MEMORY_SESSIONS, value);
}
}
}
}
}
if (sessionConfig != null) {
Set<SessionTrackingMode> trackingModes = sessionConfig.getTrackingModes();
if (trackingModes.contains(SessionTrackingMode.COOKIE)) {
appendTextChild(scNode, RuntimeTagNames.COOKIES_ENABLED, "true");
}
CookieConfig cookieConfig = sessionConfig.getCookieConfig();
if (cookieConfig != null) {
if (cookieConfig.getName() != null && cookieConfig.getName().length() > 0) {
appendTextChild(scNode, RuntimeTagNames.COOKIE_NAME, cookieConfig.getName());
}
if (cookieConfig.getPath() != null) {