public class Attachment extends Object implements XAttachment
XAttachment
Constructor and Description |
---|
Attachment(XAttachment xAttachment) |
Attachment(XMessageFormat payload) |
Attachment(XMessageFormat payload,
String contentType) |
Attachment(XMessageFormat payload,
String contentType,
MultiValueMap<String,String> headers) |
Modifier and Type | Method and Description |
---|---|
void |
addTransportHeader(String key,
String value)
Add a transport header to this attachment
|
XAttachment |
copyOf()
Creates a copy of this attachment including the payload
|
Optional<String> |
getContentType()
Retrieves the contentType of the attachment
|
Map<String,List<String>> |
getDuplicateStringTransportHeaders()
Get the map of current transport header duplicate values
|
Optional<String> |
getFirstStringTransportHeader(String key)
Get the first transport header with the given key wrapped in an
Optional |
Optional<String> |
getFirstStringTransportHeaderIgnoreCase(String key)
Get the first transport header with the given key ignoring case wrapped in an
Optional |
XMessageFormat |
getPayload()
Get the payload of the attachment
|
Map<String,String> |
getStringTransportHeaders()
Get the map of current transport header values ignoring duplicates
|
List<String> |
getStringTransportHeaders(String key)
Get a List of transport header values for the given key
|
void |
removeAllTransportHeaders()
Remove all transport headers
|
void |
removeTransportHeader(String key)
Remove all occurrences of the specified transport header
|
void |
removeTransportHeaders(String... headers)
Remove transport headers specified in the comma separated list
|
void |
replaceTransportHeader(String key,
String value)
Replace the first occurrence of the transport header with the given value
|
void |
retainOnlyTransportHeaders(String... headers)
Retain only transport headers specified in the comma separated list
|
void |
setContentType(String contentType)
Set the content type of the attachment
|
void |
setPayload(XMessageFormat payload)
Set payload of the attachment
|
public Attachment(XAttachment xAttachment)
public Attachment(XMessageFormat payload)
public Attachment(XMessageFormat payload, String contentType)
public Attachment(XMessageFormat payload, String contentType, MultiValueMap<String,String> headers)
public Optional<String> getContentType()
XAttachment
getContentType
in interface XAttachment
Optional
containing the content-type string value if it exists
and Optional.EMPTY
otherwisepublic void setContentType(String contentType)
XAttachment
setContentType
in interface XAttachment
contentType
- the content type string to be setpublic XMessageFormat getPayload()
XAttachment
getPayload
in interface XAttachment
XMessageFormat
value which represents the attachment payloadpublic void setPayload(XMessageFormat payload)
XAttachment
setPayload
in interface XAttachment
payload
- XMessageFormat
value which represents payloadpublic void addTransportHeader(String key, String value)
XAttachment
addTransportHeader
in interface XAttachment
key
- header namevalue
- header valuepublic Optional<String> getFirstStringTransportHeader(String key)
XAttachment
Optional
getFirstStringTransportHeader
in interface XAttachment
key
- String
key representing header field keyOptional
containing header content if it exists and Optional.EMPTY
otherwisepublic Optional<String> getFirstStringTransportHeaderIgnoreCase(String key)
XAttachment
Optional
getFirstStringTransportHeaderIgnoreCase
in interface XAttachment
key
- String
key representing header field keyOptional
containing header content if it exists and Optional.EMPTY
otherwisepublic List<String> getStringTransportHeaders(String key)
XAttachment
getStringTransportHeaders
in interface XAttachment
key
- the name of the transport header that is to be retrievedpublic Map<String,String> getStringTransportHeaders()
XAttachment
getStringTransportHeaders
in interface XAttachment
public Map<String,List<String>> getDuplicateStringTransportHeaders()
XAttachment
getDuplicateStringTransportHeaders
in interface XAttachment
public void removeTransportHeader(String key)
XAttachment
removeTransportHeader
in interface XAttachment
key
- header name to removepublic void removeAllTransportHeaders()
XAttachment
removeAllTransportHeaders
in interface XAttachment
public void removeTransportHeaders(String... headers)
XAttachment
removeTransportHeaders
in interface XAttachment
headers
- a list of transport headers to removepublic void retainOnlyTransportHeaders(String... headers)
XAttachment
retainOnlyTransportHeaders
in interface XAttachment
headers
- a list of transport headers to retainpublic void replaceTransportHeader(String key, String value)
XAttachment
replaceTransportHeader
in interface XAttachment
key
- the header namevalue
- the new valuepublic XAttachment copyOf()
XAttachment
copyOf
in interface XAttachment
XAttachment
Copyright © 2016–2019 AdroitLogic. All rights reserved.