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

com.bettercloud.vault.rest.RestResponse Maven / Gradle / Ivy

There is a newer version: 5.1.0
Show newest version
package com.bettercloud.vault.rest;

import java.util.Arrays;

/**
 * This class contains the metadata and data that was downloaded by Rest
 * from an HTTP response.
 */
public class RestResponse {

    private int status;
    private String mimeType;
    private byte[] body;

    /**
     *
     * @param status The HTTP status code issues for the response (e.g. 200 == OK).
     * @param mimeType The MIME type for the body contents (e.g. application/json).
     * @param body The binary payload of the response body.
     */
    public RestResponse(final int status, final String mimeType, final byte[] body) {
        this.status = status;
        this.mimeType = mimeType;
        this.body = body == null ? null : Arrays.copyOf(body, body.length);
    }

    /**
     * @return The HTTP status code issues for the response (e.g. 200 == OK).
     */
    public int getStatus() {
        return status;
    }

    /**
     * @return The MIME type for the body contents (e.g. application/json).
     */
    public String getMimeType() {
        return mimeType;
    }

    /**
     * @return The binary payload of the response body.
     */
    public byte[] getBody() {
        return Arrays.copyOf(body, body.length);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy