本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}