code: private static Response createResponse(Object object, AlluxioConfiguration alluxioConf,
        @Nullable Map<String, Object> headers) {
      if (object instanceof Void) {
        return Response.ok().build();
      }
      if (object instanceof String) {
        // Need to explicitly encode the string as JSON because Jackson will not do it automatically.
        ObjectMapper mapper = new ObjectMapper();
        try {
          return Response.ok(mapper.writeValueAsString(object)).build();
        } catch (JsonProcessingException e) {
          return createErrorResponse(e, alluxioConf);
        }
      }
  
      Response.ResponseBuilder rb = Response.ok(object);
      if (headers != null) {
        headers.forEach(rb::header);
      }
  
      if (alluxioConf.getBoolean(PropertyKey.WEBUI_CORS_ENABLED)) {
        return makeCORS(rb).build();
      }
  
      return rb.build();
    }
docs: Creates a response using the given object.
  
  @param object the object to respond with
  @return the response