APISonar


cn.dreampie.common.http.ContentType.JSON.value

> cn > dreampie > common > http > ContentType > JSON > value
cn APIs dreampie APIs common APIs http APIs ContentType APIs JSON APIs value APIs

Example 1
public HttpClientRequest setJsonParam(String jsonParam) {
    setContentType(ContentType.JSON.value() + ";charset=" + encoding);
    this.jsonParam = checkNotNull(jsonParam, "Json param could not be null.");
    return this;
  }
Example 2
public void render(HttpRequest request, HttpResponse response, Object out) {
    if (out != null) {
      response.setContentType(ContentType.JSON.value());
      if (out instanceof String) {
        if (Jsoner.isJson((String) out)) {
          write(request, response, (String) out);
        } else {
          write(request, response, "\"" + out + "\"");
        }
      } else {
        String json = Jsoner.toJSON(out);
        write(request, response, json);
      }
    }
  }