@Target(value={METHOD,TYPE}) @Retention(value=RUNTIME) @Documented public @interface MediaType
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.Modifier and Type | Fields and Description |
---|---|
static String |
ANY |
static String |
APPLICATION_CSV |
static String |
APPLICATION_HTML |
static String |
APPLICATION_JSON |
static String |
APPLICATION_OCTET_STREAM |
static String |
APPLICATION_PLAIN |
static String |
APPLICATION_XML |
static String |
TEXT_PLAIN |
Modifier and Type | Required Element and Description |
---|---|
String |
value
The mime type in RFC format.
|
Modifier and Type | Optional Element and Description |
---|---|
boolean |
strict
Whether 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 |
public static final String APPLICATION_PLAIN
public static final String APPLICATION_JSON
public static final String APPLICATION_XML
public static final String APPLICATION_HTML
public static final String APPLICATION_CSV
public static final String APPLICATION_OCTET_STREAM
public static final String TEXT_PLAIN
public static final String ANY
public abstract String value
Copyright © 2018. All rights reserved.