Interface MessageObserver
- All Known Implementing Classes:
AbstractMessageObserver,BodyCollectingMessageObserver,Connection
MessageObserver may be registered on a HTTP Message and
will be called, when the message's body becomes fully known to Membrane.
A typical example of an interceptor using MessageObserver is the
ExchangeStoreInterceptor, whose primary purpose is to write the
message's body into permanent storage. As this requires reading the body,
directly "streaming" the body from the HTTP client to the HTTP server (as
described in AbstractBody) would not be possible. Instead,
ExchangeStoreInterceptor registers a MessageObserver on the
message. This MessageObserver will be called back once streaming has
been completed and the messages' body is fully known. The
MessageObserver will then write the body into permanent storage.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbodyChunk(byte[] buffer, int offset, int length) Observes a piece of the body.voidObserves a piece of the body.voidbodyComplete(AbstractBody body) Notification that the body has fully been received.voidbodyRequested(AbstractBody body)
-
Method Details
-
bodyRequested
-
bodyChunk
Observes a piece of the body.- Parameters:
chunk-
-
bodyChunk
void bodyChunk(byte[] buffer, int offset, int length) Observes a piece of the body. Note that the buffer content may change after the method completes. -
bodyComplete
Notification that the body has fully been received.Note that this event may run instantaneously (during the call to
Message.addObserver(MessageObserver)), as the body may have already been fully received when registering the observer.This is the last event that will be fired on any MessageObserver.
-