@@ -0,0 +1,1615 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.%0Apackage com.yahoo.restapi;%0A%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport com.yahoo.container.jdisc.HttpResponse;%0Aimport com.yahoo.log.LogLevel;%0A%0Aimport java.io.IOException;%0Aimport java.io.OutputStream;%0Aimport java.util.logging.Logger;%0A%0A/**%0A * A JSON response using Jackson for serialization.%0A *%0A * @author bjorncs%0A */%0Apublic class JacksonJsonResponse%3CT%3E extends HttpResponse %7B%0A%0A    private static final Logger log = Logger.getLogger(JacksonJsonResponse.class.getName());%0A    private static final ObjectMapper defaultJsonMapper = new ObjectMapper();%0A%0A    private final ObjectMapper jsonMapper;%0A    private final T entity;%0A%0A    public JacksonJsonResponse(int statusCode, T entity) %7B%0A        this(statusCode, entity, defaultJsonMapper);%0A    %7D%0A%0A    public JacksonJsonResponse(int statusCode, T entity, ObjectMapper jsonMapper) %7B%0A        super(statusCode);%0A        this.entity = entity;%0A        this.jsonMapper = jsonMapper;%0A    %7D%0A%0A    @Override%0A    public void render(OutputStream outputStream) throws IOException %7B%0A        if (log.isLoggable(LogLevel.DEBUG)) %7B%0A            String json = jsonMapper.writeValueAsString(entity);%0A            log.log(LogLevel.DEBUG, %22Writing the following JSON to response output stream:%5Cn%22 + json);%0A            outputStream.write(json.getBytes());%0A        %7D else %7B%0A            jsonMapper.writeValue(outputStream, entity);%0A        %7D%0A    %7D%0A%0A    @Override public String getContentType() %7B return %22application/json%22; %7D%0A    public T getEntity() %7B return entity; %7D%0A%7D%0A

Add response type for JSON serialization using Jackson