private static Optional<Slime> toSlime(RestApi.RequestContext context) {
        try {
            return toString(context).map(string -> {
                log.fine(() -> "Request content: " + string);
                return SlimeUtils.jsonToSlimeOrThrow(string);
            });
        } catch (com.yahoo.slime.JsonParseException e) {
            log.log(Level.FINE, e.getMessage(), e);
            throw new RestApiException.BadRequest("Invalid JSON: " + Exceptions.toMessageString(e), e);
        }
    }
Implementations of {@link ExceptionMapper}, {@link RequestMapper} and {@link ResponseMapper}.

@author bjorncs
container-core/src/main/java/com/yahoo/restapi/RestApiMappers.java