com.adobe.pdfservices.operation.internal.http.BaseHttpResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pdfservices-sdk Show documentation
Show all versions of pdfservices-sdk Show documentation
Adobe PDF Services SDK allows you to access RESTful APIs to create, convert, and manipulate PDFs within your applications.
Older versions can be found under groupId: com.adobe.documentservices, artifactId: pdftools-sdk
/*
* Copyright 2019 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
package com.adobe.pdfservices.operation.internal.http;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import static com.adobe.pdfservices.operation.internal.http.DefaultRequestHeaders.DC_REQUEST_ID_HEADER_KEY;
public class BaseHttpResponse implements HttpResponse {
private int statusCode;
private Map headers;
private T baseResponseDto;
private List inputStreamList;
private InputStream responseContent;
public BaseHttpResponse(int statusCode, Map headers, T baseResponseDto) {
this.statusCode = statusCode;
this.headers = headers;
this.baseResponseDto = baseResponseDto;
this.responseContent = null;
}
public BaseHttpResponse(int statusCode, Map headers) {
this.statusCode = statusCode;
this.headers = headers;
this.inputStreamList = null;
this.baseResponseDto = null;
this.responseContent = null;
}
public BaseHttpResponse(int statusCode, Map headers, InputStream responseContent) {
this.statusCode = statusCode;
this.headers = headers;
this.inputStreamList = null;
this.baseResponseDto = null;
this.responseContent = responseContent;
}
@Override
public Map getHeaders() {
return headers;
}
@Override
public int getStatusCode() {
return statusCode;
}
@Override
public String getRequestId() {
if (headers != null) {
return headers.get(DC_REQUEST_ID_HEADER_KEY);
}
return null;
}
@Override
public T getBody() {
return baseResponseDto;
}
@Override
public List getResponseAsStreamList() {
return inputStreamList;
}
@Override
public void consume() throws IOException {
for (InputStream inputStream : inputStreamList) {
if (inputStream != null) {
inputStream.close();
}
}
}
@Override
public InputStream getResponseContent() {
return responseContent;
}
public T getBaseResponseDto() {
return baseResponseDto;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy