Result mapping

A ResponseEntity<> allows an endpoint implementation full control of the response.

Here is a super simple examples:

public ResponseEntity<String> getFoo() {
    return ResponseEntity.ok("foo");
}

To enable a result wrapper set the result mapping in the mapping yaml to a fully qualified java type.

map:
  result: org.springframework.http.ResponseEntity
The processor expects that it takes a single generic parameter.

Depending on the number of defined response content types the parameter of the ResponseEntity<> will be either the java type or the unknown type.

responses ResponseEntity<>

one

ResponseEntity<java type>

multiple

ResponseEntity<?>

prior to 1.0.0.M13 all results were auto-wrapped with ResponseEntity<>.

Limit to Endpoint

The result mapping works as endpoint specific mapping too. That way it is possible to use the ResponseEntity<> only on single endpoints.

So a mapping like this:

map:

  /foo:
    result: org.springframework.http.ResponseEntity

will only wrap the result of the endpoint /foo.