All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tuxdevelop.spring.batch.lightmin.util.ResponseUtil Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package org.tuxdevelop.spring.batch.lightmin.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.tuxdevelop.spring.batch.lightmin.exception.SpringBatchLightminApplicationException;

/**
 * @author Marcel Becker
 * @since 0.5
 */
@Slf4j
public final class ResponseUtil {

    private ResponseUtil() {
    }

    public static void checkHttpOk(final ResponseEntity responseEntity) {
        if (!HttpStatus.OK.equals(responseEntity.getStatusCode())) {
            final String errorMessage = "ERROR - HTTP STATUS: " + responseEntity.getStatusCode();
            throw new SpringBatchLightminApplicationException(errorMessage);
        } else {
            log.debug("Response {} ok", responseEntity);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy