public class FcrepoResponse extends Object implements Closeable
FcrepoClient.
This class implements Closeable. Suggested usage is to create the FcrepoResponse within
a try-with-resources block, insuring that any resources held by the response are freed automatically.
FcrepoClient client = ...;
try (FcrepoResponse res = client.get(...)) {
// do something with the response
} catch (FcrepoOperationFailedException|IOException e) {
// handle any exceptions
}
Closed responses have no obligation to provide access to released resources.| Constructor and Description |
|---|
FcrepoResponse(URI url,
int statusCode,
String contentType,
URI location,
InputStream body)
Create a FcrepoResponse object from the http response
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
InputStream |
getBody()
body getter
|
String |
getContentType()
contentType getter
|
URI |
getLocation()
location getter
|
int |
getStatusCode()
statusCode getter
|
URI |
getUrl()
url getter
|
boolean |
isClosed()
Whether or not the resources have been freed from this response.
|
void |
setBody(InputStream body)
body setter
|
void |
setContentType(String contentType)
contentType setter
|
void |
setLocation(URI location)
location setter
|
void |
setStatusCode(int statusCode)
statusCode setter
|
void |
setUrl(URI url)
url setter
|
public FcrepoResponse(URI url, int statusCode, String contentType, URI location, InputStream body)
url - the requested URLstatusCode - the HTTP status codecontentType - the mime-type of the responselocation - the location of a related resourcebody - the response body streampublic void close() throws IOException
Implementation note: Invoking this method will close the underlying InputStream containing the entity
body of the HTTP response.
close in interface Closeableclose in interface AutoCloseableIOException - if there is an error closing the underlying HTTP response stream.public boolean isClosed()
entity body.true if resources have been freed, otherwise falsepublic int getStatusCode()
public void setStatusCode(int statusCode)
statusCode - the HTTP status codepublic InputStream getBody()
public void setBody(InputStream body)
body - the contents of the response bodypublic URI getLocation()
public void setLocation(URI location)
location - the value of a related resourcepublic String getContentType()
public void setContentType(String contentType)
contentType - the mime-type of the responseCopyright © 2013-2016 DuraSpace, Inc.. All Rights Reserved.