Package org.imixs.workflow.importer.mail
Class IMAPImportHelper
java.lang.Object
org.imixs.workflow.importer.mail.IMAPImportHelper
A helper bean with static methods
- Version:
- 1.0
- Author:
- rsoika
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringfixContentType(String contentType, String fileName, boolean debug) Fixes malformed MIME content types in file attachments.static booleanisMediaTypeOctet(String contentType, String filename) This method returns true if the mediaType of a file attachment isstatic byte[]readAllBytes(InputStream inputStream) Read inputstream into a byte array.
-
Constructor Details
-
IMAPImportHelper
public IMAPImportHelper()
-
-
Method Details
-
isMediaTypeOctet
This method returns true if the mediaType of a file attachment is"application/octet-stream"
In some cases we have a situation where the contentType is "application/octet" which is not a valid content type. Also in this case we return true!
- Parameters:
contentType-- Returns:
-
readAllBytes
Read inputstream into a byte array.- Parameters:
inputStream-- Returns:
- Throws:
IOException
-
fixContentType
Fixes malformed MIME content types in file attachments. Some email clients or servers generate incorrect MIME types with invalid characters (dots, spaces) around the slash separator. This method cleans up these common formatting errors to ensure proper content type recognition. Common fixes applied: - application/.pdf → application/pdf - text /html → text/html - image. /jpeg → image/jpeg - application . /pdf → application/pdf The method also converts 'application/octet-stream' into 'application/pdf' if the file is a pdf file. prefixes will be striped automatically.- Parameters:
snapshot- the ItemCollection containing FileData objects to fix
-