/**
* ���롣
*/
public String encode(Map<String, Object> attrs, StoreContext storeContext) throws SessionEncoderException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 1. ���л�
// 2. ѹ��
Deflater def = new Deflater(Deflater.BEST_COMPRESSION, false);
DeflaterOutputStream dos = new DeflaterOutputStream(baos, def);
try {
serializer.serialize(assertNotNull(attrs, "objectToEncode is null"), dos);
} catch (Exception e) {
throw new SessionEncoderException("Failed to encode session state", e);
} finally {
try {
dos.close();
} catch (IOException e) {
}
def.end();
}
byte[] plaintext = baos.toByteArray().toByteArray();
// 3. ����
byte[] cryptotext = encrypt(plaintext);
// 4. base64����