Metadata Selector (.^someMetadata)
Returns the value of specified metadata for a Mule payload, variable, or attribute. The selector can return the following metadata:
- Content length metadata: .^contentLength returns the content length of the value, if the value is present. For an example, see Content Length Metadata Selector (.^contentLength).
- Class metadata: .^class returns the class of the Plain Old Java Object (POJO). For example, { “string” : payload.string.^class } might return { “string”: “java.lang.String” } if the input payload defines a Java string, such as simplePojo.string = “myString”, in a simple POJO, and { “date” : payload.date.^class } might return { “date”: “java.util.Date” }. For an example, see Class Metadata Selector (.^class).
- Encoding metadata: .^encoding returns the encoding of a value. For example, { “myEncoding” : payload.^encoding } might return {“myEncoding”: “UTF-8”} for an input POJO. For an example, see Encoding Metadata Selector (.^encoding).
- Media Type Selector: .^mediaType returns the MIME type of a value that includes parameters, for example, application/json;charset=UTF-16, and the expression in the value of { “myMediaType” : payload.^mediaType } might return “myMediaType”: “/; charset=UTF-8″ for an input POJO. For an example, see Media Type Metadata Selector (.^mediaType).
- MIME Type metadata: .^mimeType returns the MIME type (without parameters) of a value, for example, application/json, and { “myMimeType” : payload.^mimeType } might return { “myMediaType”: “/” } for an input POJO. For an example, see MIME Type Metadata Selector (.^mimeType).
- Raw metadata: .^raw returns the underlying data (typically, a binary value) of a plain old Java object (POJO). This selector is sometimes used when calculating an MD5 for hashes when checking for man-in-the-middle attacks. For examples, see Raw Metadata Selector (.^raw).
Custom metadata: .^myCustomMetadata returns the value of custom metadata. For examples, see Custom Metadata Selector (.^myCustomMetadata).
Follow Me
If you like my post please follow me to read my latest post on programming and technology.
Instagram
Facebook