Annotation Interface MediaType
@MinMuleVersion("4.1")
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Documented
public @interface MediaType
Use this annotation on operation methods and
Source classes which return either String or InputStream.
Because those types can carry data on any format, and in order to guarantee interoperability with DataWeave, such components
need to carry this operation specifying the output mime type, even if it's ANY.
The output value's mimeType will be automatically set to it. Plus, depending on the value of strict(), the runtime may
also add synthetic parameters to allow the user to specify a different one.
Operations or sources which return String or InputStream and do not carry this annotation will fail to compile.
For convenience, this class also defines a set of constants with the most common mime types.- Since:
- 1.0
-
Field Details
-
APPLICATION_PLAIN
- See Also:
-
APPLICATION_JSON
- See Also:
-
APPLICATION_XML
- See Also:
-
APPLICATION_HTML
- See Also:
-
APPLICATION_CSV
- See Also:
-
APPLICATION_OCTET_STREAM
- See Also:
-
TEXT_PLAIN
- See Also:
-
ANY
- See Also:
-
-
Element Details
-
value
String valueThe mime type in RFC format. This needs to be a mime type without any custom parameters nor encoding. If specified, those will be ignored. The runtime will only consider the primary and sub types.- Default:
- ""
-
strict
boolean strictWhether the component must only return values of the given mimeType (true), or if the user should be given the chance to override it with its own- Default:
- true
-