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