@ComponentProfile(summary="Flatten a mime-message so all body parts are part of the root multipart", tag="service,mime") public class FlattenMimeParts extends ServiceImp
MimeBodyParts
inside the payload.
Flattens the payload so that any nested Multiparts
have 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 Content-Id
header will be generated for each part if it does not already exist. Headers will be
generally untouched, but boundary markers will change.
Mime-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--
becomes
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.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
FlattenMimeParts() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp