public interface ITextBasedResponseDetector
HttpConversationManager
and IHttpConversation
objects to inject a detection mechanism recognizing textual contents.
This detector is executed before the response filter chain and before the IResponseListener
as it determines whether a Reader
can be created for the input stream. In case the
response content type contains a 'charset' parameter then the conversation flow can find out on it's own what character set to decode with, hence the detector will not be invoked.
If the logical concatenation of multiple instances of this type is planned to flexibly recognize multiple possible contents using more detectors then consider the usage of
CompositeTextBasedResponseDetector
which can rewind the response output stream before invoking each detector.
Modifier and Type | Method and Description |
---|---|
java.nio.charset.Charset |
performDetection(IReceiveEvent event)
Performs the detection of the charset of the response described by the event.
|
java.nio.charset.Charset performDetection(IReceiveEvent event) throws java.io.IOException
IReceiveEvent.getReader()
method is guaranteed to return null.
Just like for response filters, the conversation flow allows this method to sniff into the input stream which will be rewound after the invocation of this method.
event
- the receive event (containing all information except for the reader), must be non-nulljava.io.IOException
- in case of any errors during detection (typically resulting from sniffing into the response stream)