Class FlattenMimeParts
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.mime.FlattenMimeParts
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Flatten a mime-message so all body parts are part of the root multipart", tag="service,mime") public class FlattenMimeParts extends ServiceImpFlatten any nestedMimeBodyPartsinside the payload.Flattens the payload so that any nested
Multipartshave their body parts added directly to the root multipart. This can be useful if you are processing an email message; it can often contain both text and html versions of message body as a nested multipart.For example if you have a MIME message that contains 4 body parts; 3 that are plain text, and a 4th that is a multipart which itself contains 3 text parts; then the resulting output will contain 6 parts; the 3 original plain text parts and the 3 nested parts. Note that a
i.e.Content-Idheader will be generated for each part if it does not already exist. Headers will be generally untouched, but boundary markers will change.
becomesMime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3_815648243.1522235646062" ------=_Part_3_815648243.1522235646062 Content-Id: part1 ... ------=_Part_3_815648243.1522235646062 Content-Id: part2 ... ------=_Part_3_815648243.1522235646062 Content-Id: part3 ... ------=_Part_3_815648243.1522235646062 Content-Type: multipart/mixed; boundary="----=_Part_2_1537805706.1522235646062" ------=_Part_2_1537805706.1522235646062 Content-Id: nested1 ... ------=_Part_2_1537805706.1522235646062 Content-Id: nested2 ... ------=_Part_2_1537805706.1522235646062 Content-Id: nested3 ... ------=_Part_2_1537805706.1522235646062-- ------=_Part_3_815648243.1522235646062--Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_4_18130400.1522235646074" ------=_Part_4_18130400.1522235646074 Content-Id: part1 ... ------=_Part_4_18130400.1522235646074 Content-Id: part2 ... ------=_Part_4_18130400.1522235646074 Content-Id: part3 ... ------=_Part_4_18130400.1522235646074 Content-Id: nested1 ... ------=_Part_4_18130400.1522235646074 Content-Id: nested2 ... ------=_Part_4_18130400.1522235646074 Content-Id: nested3 ... ------=_Part_4_18130400.1522235646074--In the adapter configuration file this class is aliased as flatten-mime-parts which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description FlattenMimeParts()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.protected voidinitService()voidprepare()Prepare for initialisation.-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
-