Red Hat Training
A Red Hat training course is available for JBoss Enterprise SOA Platform
11.6. Using Mime Decoders in Gateway Implementations
The easiest way to make a MessageComposer use the installed mime decoders is via the ConfigTree and the
MimeDecoder.Factory
class factory method:
this.mimeDecoder = MimeDecoder.Factory.getInstanceByConfigTree(config);
This relies on the listener configuration specifying either the “mimeType” or “mimeDecoder” configuration properties (as supported by the File and FTP listeners):
<fs-listener name="FileGateway1" busidref="fileChannel1" is-gateway="true" poll-frequency-seconds="10"> <property name="mimeType" value="text/plain" /> <property name="encoding" value="UTF-8" /> </fs-listener> <fs-listener name="FileGateway2" busidref="fileChannel2" is-gateway="true" poll-frequency-seconds="10"> <property name="mimeDecoder" value="com.acme.mime.ImageJPEGMimeDecoder” /> </fs-listener>
To perform the actual decoding of the transport payload, the MessageComposer instance utilizes the decode method on its mimeDecoder instance:
Object decodedPayload = mimeDecoder.decode(payloadBytes);
It then sets the “decodedPayload” Object instance on the message instance being composed.