code: public static InputStream processResult(ServiceAccessor accessor, Context context, Renderable renderable,
                                              Result result) throws Exception {
          if (renderable.requireSerializer()) {
              ContentSerializer serializer = null;
              if (result.getContentType() != null) {
                  serializer = accessor.getContentEngines().getContentSerializerForContentType(result
                          .getContentType());
              }
              if (serializer == null) {
                  // Try with the Accept type
                  serializer = accessor.getContentEngines().getBestSerializer(context.request().mediaTypes());
                  if (serializer != null) {
                      // Set CONTENT_TYPE
                      result.with(HeaderNames.CONTENT_TYPE, serializer.getContentType());
                  }
              }
  
              if (serializer != null) {
                  serializer.serialize(renderable);
              } else {
                  LoggerFactory.getLogger(HttpHandler.class)
                          .error("Cannot find a serializer to handle the request (explicit content type: {}, " +
                                          "accept media types: {}), returning content as String",
                                  result.getContentType(),
                                  context.request().mediaTypes());
                  if (renderable.content() != null) {
                      renderable.setSerializedForm(renderable.content().toString());
                      result.with(HeaderNames.CONTENT_TYPE, "text/plain");
                  } else {
                      renderable = NoHttpBody.INSTANCE;
                      result.with(HeaderNames.CONTENT_TYPE, "text/plain");
                  }
              }
          }
          return renderable.render(context, result);
      }
docs: Processes the given result. This method returns either the "rendered renderable",
  but also applies required serialization if any.
  
  @param accessor   the service accessor
  @param context    the current HTTP context
  @param renderable the renderable object
  @param result     the computed result
  @return the stream of the result
  @throws Exception if the result cannot be rendered.