项目:geeCommerce-Java-Shop-Software-and-PIM
文件:JavaSerializer.java
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;
}
项目:geeCommerce-Java-Shop-Software-and-PIM
文件:JavaSerializer.java
public static HttpSession deserializeInto(byte[] data,HttpSession session,ClassLoader loader)
throws IOException,ClassNotFoundException,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;
}
项目:jerrydog
文件:HttpRequestFacade.java
public HttpSession getSession(boolean create) {
HttpSession session =
((HttpServletRequest) request).getSession(create);
if (session == null)
return null;
else
return new StandardSessionFacade(session);
}
项目:HowTomcatWorks
文件:HttpRequestFacade.java
public HttpSession getSession(boolean create) {
HttpSession session =
((HttpServletRequest) request).getSession(create);
if (session == null)
return null;
else
return new StandardSessionFacade(session);
}
项目:gwt-comet
文件:GlassFishAsyncServlet.java
public GlassFishAsyncServlet() throws SecurityException,NoSuchFieldException {
sessionField = StandardSessionFacade.class.getDeclaredField("session");
sessionField.setAccessible(true);
}
项目:gwt-comet
文件:Catalina60AsyncServlet.java
public Catalina60AsyncServlet() throws SecurityException,NoSuchFieldException {
sessionField = StandardSessionFacade.class.getDeclaredField("session");
sessionField.setAccessible(true);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。