com.bettercloud.vault.rest.RestResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vault-java-driver Show documentation
Show all versions of vault-java-driver Show documentation
Zero-dependency Java client for HashiCorp's Vault
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);
}
}