/** * Create a {@code ByteInput} wrapper for a {@code ByteBuffer}. * * @param buffer the byte buffer * @return the byte input wrapper */ public static ByteInput createByteInput(final ByteBuffer buffer) { return new ByteBufferInput(buffer); }
private Object deserialize(final String info) throws IOException, ClassNotFoundException { byte[] data = Base64.getDecoder().decode(info.trim()); Unmarshaller unmarshaller = factory.createUnmarshaller(configuration); unmarshaller.start(new ByteBufferInput(ByteBuffer.wrap(data))); try { return unmarshaller.readObject(); } finally { unmarshaller.close(); } }
@Override public Map<String, PersistentSession> loadSessionAttributes(String deploymentName, final ClassLoader classLoader) { try { Unmarshaller unmarshaller = createUnmarshaller(); try { long time = System.currentTimeMillis(); Map<String, SessionEntry> data = loadSerializedSessions(deploymentName); if (data != null) { Map<String, PersistentSession> ret = new HashMap<String, PersistentSession>(); for (Map.Entry<String, SessionEntry> sessionEntry : data.entrySet()) { if (sessionEntry.getValue().expiry.getTime() > time) { Map<String, Object> session = new HashMap<String, Object>(); for (Map.Entry<String, byte[]> sessionAttribute : sessionEntry.getValue().data.entrySet()) { unmarshaller.start(new ByteBufferInput(ByteBuffer.wrap(sessionAttribute.getValue()))); session.put(sessionAttribute.getKey(), unmarshaller.readObject()); unmarshaller.finish(); } ret.put(sessionEntry.getKey(), new PersistentSession(sessionEntry.getValue().expiry, session)); } } return ret; } } finally { unmarshaller.close(); } } catch (Exception e) { UndertowServletLogger.ROOT_LOGGER.failedtoLoadPersistentSessions(e); } return null; }
/** * Create a {@code ByteInput} wrapper for a {@code ByteBuffer}. * * @param buffer the byte buffer * @return the byte input wrapper */ public static ByteInput createByteInput(final ByteBuffer buffer) { return new ByteBufferInput(buffer); }
/** * Create a {@code ByteInput} wrapper for a {@code ByteBuffer}. * * @param buffer the byte buffer * @return the byte input wrapper */ public static ByteInput createByteInput(final ByteBuffer buffer) { return new ByteBufferInput(buffer); }
/** * Create a {@code ByteInput} wrapper for a {@code ByteBuffer}. * * @param buffer the byte buffer * @return the byte input wrapper */ public static ByteInput createByteInput(final ByteBuffer buffer) { return new ByteBufferInput(buffer); }
/** * Create a {@code ByteInput} wrapper for a {@code ByteBuffer}. * * @param buffer the byte buffer * @return the byte input wrapper */ public static ByteInput createByteInput(final ByteBuffer buffer) { return new ByteBufferInput(buffer); }
/** * Create a {@code ByteInput} wrapper for a {@code ByteBuffer}. * * @param buffer the byte buffer * @return the byte input wrapper */ public static ByteInput createByteInput(final ByteBuffer buffer) { return new ByteBufferInput(buffer); }
@Override public Map<String, PersistentSession> loadSessionAttributes(String deploymentName, final ClassLoader classLoader) { try { Unmarshaller unmarshaller = createUnmarshaller(); try { long time = System.currentTimeMillis(); Map<String, SessionEntry> data = loadSerializedSessions(deploymentName); if (data != null) { Map<String, PersistentSession> ret = new HashMap<String, PersistentSession>(); for (Map.Entry<String, SessionEntry> sessionEntry : data.entrySet()) { if (sessionEntry.getValue().expiry.getTime() > time) { Map<String, Object> session = new HashMap<String, Object>(); for (Map.Entry<String, byte[]> sessionAttribute : sessionEntry.getValue().data.entrySet()) { unmarshaller.start(new ByteBufferInput(ByteBuffer.wrap(sessionAttribute.getValue()))); session.put(sessionAttribute.getKey(), unmarshaller.readObject()); unmarshaller.finish(); } ret.put(sessionEntry.getKey(), new PersistentSession(sessionEntry.getValue().expiry, session)); } } return ret; } } finally { unmarshaller.close(); } } catch (Exception e) { UndertowServletLogger.ROOT_LOGGER.failedtoLoadPersistentSessions(e); } return null; }
@Override public Map<String, PersistentSession> loadSessionAttributes(String deploymentName, final ClassLoader classLoader) { try { Unmarshaller unmarshaller = createUnmarshaller(); try { long time = System.currentTimeMillis(); Map<String, SessionEntry> data = loadSerializedSessions(deploymentName); if (data != null) { Map<String, PersistentSession> ret = new HashMap<String, PersistentSession>(); for (Map.Entry<String, SessionEntry> sessionEntry : data.entrySet()) { if (sessionEntry.getValue().expiry.getTime() > time) { Map<String, Object> session = new HashMap<String, Object>(); for (Map.Entry<String, byte[]> sessionAttribute : sessionEntry.getValue().data.entrySet()) { unmarshaller.start(new ByteBufferInput(ByteBuffer.wrap(sessionAttribute.getValue()))); session.put(sessionAttribute.getKey(), unmarshaller.readObject()); unmarshaller.finish(); } ret.put(sessionEntry.getKey(), new PersistentSession(sessionEntry.getValue().expiry, session)); } } return ret; } } finally { unmarshaller.close(); } } catch (Exception e) { UndertowServletLogger.ROOT_LOGGER.failedtoLoadPersistentSessions(e); } return null; }