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

com.volcengine.model.response.RawResponse Maven / Gradle / Ivy

There is a newer version: 1.0.192
Show newest version
package com.volcengine.model.response;

import lombok.Data;
import org.apache.http.Header;

@Data
public class RawResponse {

    private byte[] data;
    private int code;
    private Exception exception;
    //response header and origin http response code
    private Header[] headers;
    private int httpCode;

    public RawResponse(byte[] data, int code, Exception e) {
        this.data = data;
        this.code = code;
        this.exception = e;
    }

    public RawResponse(byte[] data, int code, Exception exception, Header[] headers) {
        this.data = data;
        this.code = code;
        this.exception = exception;
        this.headers = headers;
    }

    public RawResponse(byte[] data, int code, Exception exception, Header[] headers, int httpCode) {
        this.data = data;
        this.code = code;
        this.exception = exception;
        this.headers = headers;
        this.httpCode = httpCode;
    }

    public String getFirstHeader(String key) {
        if (key != null && headers != null) {
            for (Header header : headers) {
                if (header.getName().equalsIgnoreCase(key)) {
                    return header.getValue();
                }
            }
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy