Text file Content Handler

I am polling a Email port and getting a text file as attachement in the email. when i process it i get a stream. But it says no Content Handler found for the specified type. How shud i code for it and where does the content handler play its role . Please explain me in detail.


There are certain file content types that require non-trivial generic processing. For instance, an XML file should be parsed. Integration Server supports registering ContentHandlers to perform this generic processing.

There are a number of different ways into the Integration Server. HTTP POST, Email, FTP, etc. The HTTP or MIME Content-Type header is used to figure out which ContentHandler to run on the input. The FTP file extension is used (along with the lib/mime.types file) to figure out what ContentHandler to run on incoming FTP files.

Generally there isn’t anything generic that can be done to a file of text/plain type, so the default ContentHandler is used. That handler just puts the stream in the pipeline and the service can do whatever processing it wants to on the incoming data. For many file types this is exactly what you want (that message is not an error, just informing you that the default ContentHandler was used).

BTW, there is an example of an implementation of a ContentHandler in the WmSamples package.



What is ur receiving service input signature set to?

Please set it to contentStream(object)this will extract the stream from the pipeline and do use streamTobytes and bytesToString to see the content.



I remember once registering text/plain content handler as:
ServerAPI.registerContentHandler(“text/plain”, new HandlerFactory_txt());


You should not need to register either the text/plain or the text/xml content types unless you want to create a new ContentHandler to modify the default behavior. This is not something I would recommend unless you really, really understand what you are doing.

Do a search here for ContentHandler. There are many informative posts addressing how to create and register new content handlers.