Package com.ibm.fhir.client
Interface FHIRResponse
-
- All Known Implementing Classes:
FHIRResponseImpl
public interface FHIRResponse
This interface represents a response received from a FHIR REST API invocation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getETag()
This method is used to retrieve the value of the ETag response HTTP header.java.time.Instant
getLastModified()
This method is used to retrieve the Last-Modified response HTTP header.java.lang.String
getLocation()
This method is used to retrieve the value of the Location response HTTP header as a String.java.net.URI
getLocationURI()
This method is used to retrieve the value of the Location response HTTP header as a URI.<T> T
getResource(java.lang.Class<T> type)
This method is used to retrieve the resource returned in a FHIR REST API response.javax.ws.rs.core.Response
getResponse()
Returns the underlying JAX-RS 2.0 Response object associated with this FHIRResponse.int
getStatus()
This method is used to retrieve the numeric HTTP status code associated with a FHIR REST API response.boolean
isEmpty()
Returns whether the response contains a FHIR Resource entity.java.lang.String[]
parseLocation(java.lang.String locationString)
This function will parse the specified location value into its constituent parts and return a String array containing the individual parts.
-
-
-
Method Detail
-
getStatus
int getStatus()
This method is used to retrieve the numeric HTTP status code associated with a FHIR REST API response.- Returns:
- the HTTP status code
-
getLocation
java.lang.String getLocation() throws java.lang.Exception
This method is used to retrieve the value of the Location response HTTP header as a String.- Returns:
- the Location response header value as a String
- Throws:
java.lang.Exception
-
getLocationURI
java.net.URI getLocationURI() throws java.lang.Exception
This method is used to retrieve the value of the Location response HTTP header as a URI.- Returns:
- the Location response header value as a URI
- Throws:
java.lang.Exception
-
getLastModified
java.time.Instant getLastModified() throws java.lang.Exception
This method is used to retrieve the Last-Modified response HTTP header.- Returns:
- Throws:
java.lang.Exception
-
getETag
java.lang.String getETag() throws java.lang.Exception
This method is used to retrieve the value of the ETag response HTTP header.- Returns:
- the ETag response header value
- Throws:
java.lang.Exception
-
getResource
<T> T getResource(java.lang.Class<T> type) throws java.lang.Exception
This method is used to retrieve the resource returned in a FHIR REST API response.- Parameters:
type
- this should be ajava.lang.Class
value which indicates the type of return value expected- Returns:
- Throws:
java.lang.Exception
-
getResponse
javax.ws.rs.core.Response getResponse() throws java.lang.Exception
Returns the underlying JAX-RS 2.0 Response object associated with this FHIRResponse.- Returns:
- the JAX-RS Response
- Throws:
java.lang.Exception
-
parseLocation
java.lang.String[] parseLocation(java.lang.String locationString) throws java.lang.Exception
This function will parse the specified location value into its constituent parts and return a String array containing the individual parts. The resulting String array returned by this function will contain the following values:- Index 0 - the resource type
- Index 1 - the resource id
- Index 2 - the version id (optional)
- If you call
parseLocation
with the value "http://localhost:9080/fhir-server/api/v4/Patient/23/_history/2", then you should receive this String array:- [0] - "Patient"
- [1] - "23"
- [2] - "2"
- If you call
parseLocation
with the value "http://localhost:9080/fhir-server/api/v4/Observation/38", then you should receive this String array:- [0] - "Observation"
- [1] - "38"
- Parameters:
locationString
- a resource's location URI as a string; this will typically be the value returned by the getLocation() method.- Returns:
- a String array containing the individual parts of the location string or null if the specified location value could not be parsed or was passed in as null.
- Throws:
java.lang.Exception
-
isEmpty
boolean isEmpty()
Returns whether the response contains a FHIR Resource entity.- Returns:
- true if the response body is empty, otherwise false
-
-