StandardSession standardSession = (StandardSession) session; standardSession.passivate(); standardSession.writeObjectData(oos); } else {
@Override public byte[] serializeFrom(HttpSession session) throws IOException { StandardSession standardSession = (StandardSession) session; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(bos)); oos.writeLong(standardSession.getCreationTime()); standardSession.writeObjectData(oos); oos.close(); return bos.toByteArray(); }
/** * Serialize a {@link Session} * * @param session the {@link Session} to serialize * @return a {@code byte[]} representing the serialized {@link Session} * @throws IOException */ public byte[] serialize(Session session) throws IOException { ByteArrayOutputStream bytes = null; ObjectOutputStream out = null; try { bytes = new ByteArrayOutputStream(); out = new ObjectOutputStream(bytes); StandardSession standardSession = (StandardSession) session; standardSession.writeObjectData(out); out.flush(); bytes.flush(); return bytes.toByteArray(); } finally { closeQuietly(out, bytes); } }
/** * Serialize a {@link Session} * * @param session the {@link Session} to serialize * @return a {@code byte[]} representing the serialized {@link Session} * @throws IOException */ public byte[] serialize(Session session) throws IOException { ByteArrayOutputStream bytes = null; ObjectOutputStream out = null; try { bytes = new ByteArrayOutputStream(); out = new ObjectOutputStream(bytes); StandardSession standardSession = (StandardSession) session; standardSession.writeObjectData(out); out.flush(); bytes.flush(); return bytes.toByteArray(); } finally { closeQuietly(out, bytes); } }
@Override public DynamoSessionItem toSessionItem(Session session) { ObjectOutputStream oos = null; try { ByteArrayOutputStream fos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(fos); ((StandardSession) session).writeObjectData(oos); oos.close(); DynamoSessionItem sessionItem = new DynamoSessionItem(session.getIdInternal()); sessionItem.setSessionData(ByteBuffer.wrap(fos.toByteArray())); return sessionItem; } catch (Exception e) { IOUtils.closeQuietly(oos, null); throw new SessionConversionException("Unable to convert Tomcat Session into Dynamo storage representation", e); } } }
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
/** * Save the specified Session into this Store. Any previously saved * information for the associated session identifier is replaced. * * @param session Session to be saved * * @exception IOException if an input/output error occurs */ @Override public void save(Session session) throws IOException { // Open an output stream to the specified pathname, if any File file = file(session.getIdInternal()); if (file == null) { return; } if (manager.getContext().getLogger().isDebugEnabled()) { manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".saving", session.getIdInternal(), file.getAbsolutePath())); } try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath()); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(fos))) { ((StandardSession)session).writeObjectData(oos); } }
/** * Save the specified Session into this Store. Any previously saved * information for the associated session identifier is replaced. * * @param session Session to be saved * * @exception IOException if an input/output error occurs */ @Override public void save(Session session) throws IOException { // Open an output stream to the specified pathname, if any File file = file(session.getIdInternal()); if (file == null) { return; } if (manager.getContext().getLogger().isDebugEnabled()) { manager.getContext().getLogger().debug(sm.getString(getStoreName() + ".saving", session.getIdInternal(), file.getAbsolutePath())); } try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath()); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(fos))) { ((StandardSession)session).writeObjectData(oos); } }
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
((StandardSession)session).writeObjectData(oos); } finally { oos.close();
oos = new ObjectOutputStream(new BufferedOutputStream(bos)); ((StandardSession) session).writeObjectData(oos); oos.close(); oos = null;
list.add(session); session.passivate(); session.writeObjectData(oos);
list.add(session); session.passivate(); session.writeObjectData(oos);
try (ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(bos))) { ((StandardSession) session).writeObjectData(oos);