本文整理汇总了Java中org.apache.catalina.session.StandardSessionFacade类的典型用法代码示例。如果您正苦于以下问题:Java StandardSessionFacade类的具体用法?Java StandardSessionFacade怎么用?Java StandardSessionFacade使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StandardSessionFacade类属于org.apache.catalina.session包,在下文中一共展示了StandardSessionFacade类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeFrom
import org.apache.catalina.session.StandardSessionFacade; //导入依赖的package包/类
public static byte[] serializeFrom(HttpSession session) throws IOException, NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
if (session != null) {
Field facadeSessionField = StandardSessionFacade.class.getDeclaredField("session");
facadeSessionField.setAccessible(true);
StandardSession standardSession = (StandardSession) facadeSessionField.get(session);
if (standardSession != null) {
// StandardSessionFacade standardSession =
// (StandardSessionFacade) session;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(bos));
oos.writeLong(standardSession.getCreationTime());
standardSession.writeObjectData(oos);
oos.close();
return bos.toByteArray();
}
}
return null;
}
示例2: deserializeInto
import org.apache.catalina.session.StandardSessionFacade; //导入依赖的package包/类
public static HttpSession deserializeInto(byte[] data, HttpSession session, ClassLoader loader)
throws IOException, ClassNotFoundException, NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
if (data != null && data.length > 0 && session != null) {
Field facadeSessionField = StandardSessionFacade.class.getDeclaredField("session");
facadeSessionField.setAccessible(true);
StandardSession standardSession = (StandardSession) facadeSessionField.get(session);
// StandardSessionFacade standardSession = (StandardSessionFacade)
// session;
BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(data));
ObjectInputStream ois = new CustomObjectInputStream(bis, loader);
standardSession.setCreationTime(ois.readLong());
standardSession.readObjectData(ois);
}
return session;
}
示例3: getSession
import org.apache.catalina.session.StandardSessionFacade; //导入依赖的package包/类
public HttpSession getSession(boolean create) {
HttpSession session =
((HttpServletRequest) request).getSession(create);
if (session == null)
return null;
else
return new StandardSessionFacade(session);
}
示例4: GlassFishAsyncServlet
import org.apache.catalina.session.StandardSessionFacade; //导入依赖的package包/类
public GlassFishAsyncServlet() throws SecurityException, NoSuchFieldException {
sessionField = StandardSessionFacade.class.getDeclaredField("session");
sessionField.setAccessible(true);
}
示例5: Catalina60AsyncServlet
import org.apache.catalina.session.StandardSessionFacade; //导入依赖的package包/类
public Catalina60AsyncServlet() throws SecurityException, NoSuchFieldException {
sessionField = StandardSessionFacade.class.getDeclaredField("session");
sessionField.setAccessible(true);
}