org.tuxdevelop.spring.batch.lightmin.util.RequestUtil Maven / Gradle / Ivy
package org.tuxdevelop.spring.batch.lightmin.util;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import java.util.Collections;
/**
* @author Marcel Becker
* @since 0.5
*/
public final class RequestUtil {
private RequestUtil() {
}
public static HttpEntity createApplicationJsonEntity(final T body) {
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON_UTF8));
return new HttpEntity<>(body, HttpHeaders.readOnlyHttpHeaders(headers));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy