org.szegedi.spring.web.jsflow.codec
Class CompositeCodec

java.lang.Object
  extended by org.szegedi.spring.web.jsflow.codec.CompositeCodec
All Implemented Interfaces:
BinaryStateCodec

public class CompositeCodec
extends java.lang.Object
implements BinaryStateCodec

A codec that composes several other codecs. You will typically use it to compose a CompressionCodec, ConfidentialityCodec and a IntegrityCodec into a single codec (in this order). Note that any of these are optional, although if you are using the ClientSideFlowStateStorage, you should at least use integrity codec to prevent the client from tampering with the state. If you use the confidentiality codec to encrypt the state as well because you are concerned about leaking out any confidential information, then use the compression codec as well as compression improves the security of the encryption. Also consider wrapping this codec into a PooledCodec if you use either confidentiality or integrity, as their coding operations can have high initialization overhead.

Version:
$Id: CompositeCodec.java 10 2006-05-16 09:49:48Z szegedia $
Author:
Attila Szegedi

Constructor Summary
CompositeCodec()
           
 
Method Summary
 OneWayCodec createDecoder()
          Create a one-way single-threaded, nonshared codec instance able to decode a state as received from the client or from an upstream codec.
 OneWayCodec createEncoder()
          Create a one-way single-threaded, nonshared codec instance able to encode a state as should be sent to a client or a downstream codec.
 void setCodecs(java.util.List codecs)
          Sets the component codecs of this codec - each of them instance of BinaryStateCodec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeCodec

public CompositeCodec()
Method Detail

setCodecs

public void setCodecs(java.util.List codecs)
Sets the component codecs of this codec - each of them instance of BinaryStateCodec. The codecs are applied in the specified order when encoding, and in reverse order when decoding.

Parameters:
codecs - the component codecs.

createDecoder

public OneWayCodec createDecoder()
                          throws java.lang.Exception
Description copied from interface: BinaryStateCodec
Create a one-way single-threaded, nonshared codec instance able to decode a state as received from the client or from an upstream codec.

Specified by:
createDecoder in interface BinaryStateCodec
Returns:
the codec for decoding
Throws:
java.lang.Exception

createEncoder

public OneWayCodec createEncoder()
                          throws java.lang.Exception
Description copied from interface: BinaryStateCodec
Create a one-way single-threaded, nonshared codec instance able to encode a state as should be sent to a client or a downstream codec.

Specified by:
createEncoder in interface BinaryStateCodec
Returns:
the codec for encoding
Throws:
java.lang.Exception