org.apache.catalina.session.StandardSessionFacade的实例源码

项目: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);
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...