Class ClientEngine<Q extends MessageHeader,R extends MessageHeader>

java.lang.Object
org.jdrupes.httpcodec.Engine
org.jdrupes.httpcodec.ClientEngine<Q,R>
Type Parameters:
Q - the message header type handled be the encoder (the request)
R - the message header type handled by the decoder (the response)

public class ClientEngine<Q extends MessageHeader,R extends MessageHeader> extends Engine
An engine that can be used as a client.

It has an associated request encoder and a response decoder. Using a ClientEngine has two main advantages over using an encoder and decoder directly. It links encoder and decoder (see Encoder.setPeerDecoder(Decoder) and Decoder.setPeerEncoder(Encoder)) and it replaces the encoder and decoder if the decoded result indicates a switch. The change takes place upon the next encode or decode invocation. The “old” encoders and decoders are thus still available when the result of a decode invocation, that indicates a switch, is processed.

  • Constructor Details

    • ClientEngine

      public ClientEngine(Encoder<Q,R> requestEncoder, Decoder<R,Q> responseDecoder)
      Creates a new instance.
      Parameters:
      requestEncoder - the encoder for the request
      responseDecoder - the decoder for the response
  • Method Details