Annotation Interface Content
Should be used on
EntryPath
-annotated methods on Controller
-annotated classes.
On parameters, the request body content is passed in as the following:
-
If the content type is any of the
application/xml
equivalents and aXMLDriver
component is found, the driver is used to convert to the target type. -
If the content type is
application/json
and aJSONDriver
is found, the driver is used to convert to the target type. - Else, if the content is anything else, the following types are valid as a target type:
- All primitives (if input is parseable text).
- All boxed primitives (if input is parseable text).
- byte[],
ByteArrayInputStream
,ServletInputStream
,InputStream
(for binary). String
,StringReader
,BufferedReader
,InputStreamReader
,Reader
(for characters).
- Otherwise, an error is thrown.
RequestMethod.POST
, RequestMethod.PUT
, or RequestMethod.PATCH
.
If on a method, this converts the returned object after running the method into data that is put into the response body.
- If return type is a
SmallResponse
, its content is the object to convert (other headers and statuses are set on the response), and conversion continues below for the content... - If return type is a
SmallModelView
, the view is resolved and written to the response. - If return type is a
File
,- ...the content type is changed to the file's predicted MIME-type and the content is the file's content, verbatim. Unknown type is
application/octet-stream
. - ...and is null, this sends a 404.
- ...the content type is changed to the file's predicted MIME-type and the content is the file's content, verbatim. Unknown type is
- If return type is a
Reader
,CharSequence
,String
,StringBuilder
, orStringBuffer
, plain text is sent back. Content type istext/plain
if unspecified. - If return type is byte[] or
ByteBuffer
binary data is sent back. Content type isapplication/octet-stream
if unspecified. - If return type is any other object type,
- ...and a
XMLDriver
component is found, and the specified content type isapplication/xml
or an XML subtype, the object is converted to XML. - ...and a
JSONDriver
component is found, content type isapplication/json
and the object is converted.
- ...and a
- Author:
- Matthew Tropiano
- See Also:
-
Optional Element Summary
-
Element Details
-
value
String value- Returns:
- the forced MIME-Type.
- Default:
- ""
-