com.aliyun.datahub.client.http.common.HttpEntity Maven / Gradle / Ivy
The newest version!
package com.aliyun.datahub.client.http.common;
import static com.aliyun.datahub.client.http.common.Constants.CONTENT_FORM;
import static com.aliyun.datahub.client.http.common.Constants.CONTENT_JSON;
public class HttpEntity {
private T entity;
private String contentType;
private HttpEntity(T entity, String contentType) {
this.entity = entity;
this.contentType = contentType;
}
public static HttpEntity json(T entity) {
return new HttpEntity<>(entity, CONTENT_JSON);
}
public static HttpEntity form(HttpForm form) {
return new HttpEntity<>(form, CONTENT_FORM);
}
public T getEntity() {
return entity;
}
public String getContentType() {
return contentType;
}
}