REST handler method response
- Last Updated: February 11, 2026
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Each REST handler method must send a response or throw an exception. The method may handle the response or allow the framework to convert the method return value to a JSON string. All responses are can be Content-Type specified as application/JSON. Though this is not mandatory, the handler method must handle the HTTP Content-Type header and response body.
The response from a method can be one of the following types:
- String — If the type of object returned from the method is String, it is returned as-is with no validity checks. The method must ensure that the string is a properly formatted JSON encoded string.
- ObjectNode — If the type of object returned from the method is ObjectNode, a part of Jackson JSON library, the framework serializes it and writes it back to the client.
- Plain old Java object — If the type of object returned
from the method is a Java object, the framework attempts to convert it to a JSON
encoded string using the built-in Jackson library. If the object cannot be
converted to a JSON encoded string, an
HTTP 500 Internal Server Erroris returned to the client, and the exception is recorded in the fathom error log file.
Note: Returning a string or an ObjectNode is quicker than returning a Java object
because the latter avoids using reflection to serialize the object.
For
details about Jackson capabilities, see https://github.com/FasterXML/jackson.An example of a method returning String:
|
An example of a method returning ObjectNode:
|
An example of a method returning Plain old Java object:
|