当前位置: 首页>>代码示例>>Java>>正文


Java CustomObjectInputStream类代码示例

本文整理汇总了Java中org.apache.catalina.util.CustomObjectInputStream的典型用法代码示例。如果您正苦于以下问题:Java CustomObjectInputStream类的具体用法?Java CustomObjectInputStream怎么用?Java CustomObjectInputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CustomObjectInputStream类属于org.apache.catalina.util包,在下文中一共展示了CustomObjectInputStream类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserializeInto

import org.apache.catalina.util.CustomObjectInputStream; //导入依赖的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;
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:21,代码来源:JavaSerializer.java

示例2: deserializeInto

import org.apache.catalina.util.CustomObjectInputStream; //导入依赖的package包/类
@Override
public void deserializeInto(byte[] data, RedisSession session, SessionSerializationMetadata metadata) throws IOException, ClassNotFoundException {
  try(
      BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(data));
      ObjectInputStream ois = new CustomObjectInputStream(bis, loader);
  ) {
    SessionSerializationMetadata serializedMetadata = (SessionSerializationMetadata)ois.readObject();
    metadata.copyFieldsFrom(serializedMetadata);
    session.readObjectData(ois);
  }
}
 
开发者ID:ctchengt,项目名称:tomcat8-redis-session-manager,代码行数:12,代码来源:JavaSerializer.java

示例3: deserializeInto

import org.apache.catalina.util.CustomObjectInputStream; //导入依赖的package包/类
@Override
public void deserializeInto(byte[] data, RedisSession session, SessionSerializationMetadata metadata) throws IOException, ClassNotFoundException {
    try(
            BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(data));
            ObjectInputStream ois = new CustomObjectInputStream(bis, loader);
    ) {
        SessionSerializationMetadata serializedMetadata = (SessionSerializationMetadata)ois.readObject();
        metadata.copyFieldsFrom(serializedMetadata);
        session.readObjectData(ois);
    }
}
 
开发者ID:HomoEfficio,项目名称:tomcat-extensions-redis-session-manager,代码行数:12,代码来源:JavaSerializer.java

示例4: deserializeInto

import org.apache.catalina.util.CustomObjectInputStream; //导入依赖的package包/类
@Override
public void deserializeInto(byte[] data, CustomSession session, SessionMetadata metadata) throws IOException, ClassNotFoundException {
	try (BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(data));
			ObjectInputStream ois = new CustomObjectInputStream(bis, loader);) {
		
		SessionMetadata serializedMetadata = (SessionMetadata) ois.readObject();
		metadata.copyFieldsFrom(serializedMetadata);
		session.readObjectData(ois);
	}
}
 
开发者ID:liuxinglanyue,项目名称:distributed-session-manager,代码行数:11,代码来源:JavaSerializer.java

示例5: fromBinary

import org.apache.catalina.util.CustomObjectInputStream; //导入依赖的package包/类
protected final NonStickySession fromBinary(byte[] binary) throws ClassNotFoundException, IOException {
    try (ObjectInputStream ois = new CustomObjectInputStream(new ByteArrayInputStream(binary), loader)) {
        NonStickySession session = createEmptySession();
        session.readObjectData(ois);
        session.setManager(this);
        return session;
    }
}
 
开发者ID:pvahhi,项目名称:tomcat-redis-session-manager,代码行数:9,代码来源:NonStickySessionManager.java


注:本文中的org.apache.catalina.util.CustomObjectInputStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。