package com.fujitsu.eFrame.eftool;
import javax.servlet.http.HttpSession;
import com.fujitsu.uji.DispatchContext;
import com.fujitsu.uji.http.HttpSessionProfile;
public class SessionUtil {
private static HttpSession getSession(DispatchContext context) {
return ((HttpSessionProfile)context.getSessionProfile()).getSession();
}
public static Object getAttribute(DispatchContext context, String name) {
try {
return getSession(context).getAttribute(name);
} catch (IllegalStateException ex){
return null;
}
}
public static void setAttribute(DispatchContext context, String name, Object value) {
getSession(context).setAttribute(name, value);
}
public static void setTimeout(DispatchContext context, int seconds) {
getSession(context).setMaxInactiveInterval(seconds);
}
}
本文地址:http://com.8s8s.com/it/it14099.htm