
Class FhirRequestBuilder
java.lang.Object
org.hl7.fhir.r5.utils.client.network.FhirRequestBuilder
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFhirRequestBuilder
(org.hl7.fhir.utilities.http.HTTPRequest httpRequest, String source) -
Method Summary
Modifier and TypeMethodDescription<T extends Resource>
ResourceRequest<T> execute()
protected static org.hl7.fhir.utilities.http.HTTPRequest
formatHeaders
(org.hl7.fhir.utilities.http.HTTPRequest request, String format, Iterable<org.hl7.fhir.utilities.http.HTTPHeader> headers) Adds necessary default headers, formatting headers, and any passed inHTTPHeader
s to the passed inHTTPRequest
protected static String
getLocationHeader
(Iterable<org.hl7.fhir.utilities.http.HTTPHeader> headers) Extracts the 'location' header from the passed headers.protected org.hl7.fhir.utilities.http.ManagedFhirWebAccessor
protected IParser
Returns the appropriate parser based on the format type passed in.protected static Iterable
<org.hl7.fhir.utilities.http.HTTPHeader> getResourceFormatHeaders
(org.hl7.fhir.utilities.http.HTTPRequest httpRequest, String format) Adds necessary headers for the given resource format provided.protected static boolean
Returns true if any of theOperationOutcome.OperationOutcomeIssueComponent
within the providedOperationOutcome
have anOperationOutcome.IssueSeverity
ofOperationOutcome.IssueSeverity.ERROR
orOperationOutcome.IssueSeverity.FATAL
protected Bundle
unmarshalFeed
(org.hl7.fhir.utilities.http.HTTPResult response, String format) Unmarshalls Bundle from response stream.protected <T extends Resource>
TunmarshalReference
(org.hl7.fhir.utilities.http.HTTPResult response, String format, String resourceType) Unmarshalls a resource from the response stream.withHeaders
(Iterable<org.hl7.fhir.utilities.http.HTTPHeader> headers) withLogger
(org.hl7.fhir.utilities.ToolingClientLogger logger) withMessage
(String message) withResourceFormat
(String resourceFormat) withRetryCount
(int retryCount) withTimeout
(long timeout, TimeUnit unit)
-
Field Details
-
DEFAULT_CHARSET
- See Also:
-
LOCATION_HEADER
- See Also:
-
CONTENT_LOCATION_HEADER
- See Also:
-
-
Constructor Details
-
FhirRequestBuilder
-
-
Method Details
-
formatHeaders
protected static org.hl7.fhir.utilities.http.HTTPRequest formatHeaders(org.hl7.fhir.utilities.http.HTTPRequest request, String format, Iterable<org.hl7.fhir.utilities.http.HTTPHeader> headers) Adds necessary default headers, formatting headers, and any passed inHTTPHeader
s to the passed inHTTPRequest
- Parameters:
request
-HTTPRequest
to add headers to.format
- ExpectedResource
format.headers
- Any additionalHTTPHeader
s to add to the request.
-
getResourceFormatHeaders
protected static Iterable<org.hl7.fhir.utilities.http.HTTPHeader> getResourceFormatHeaders(org.hl7.fhir.utilities.http.HTTPRequest httpRequest, String format) Adds necessary headers for the given resource format provided.- Parameters:
httpRequest
-HTTPRequest
to add default headers to.format
- ExpectedResource
format.
-
hasError
Returns true if any of theOperationOutcome.OperationOutcomeIssueComponent
within the providedOperationOutcome
have anOperationOutcome.IssueSeverity
ofOperationOutcome.IssueSeverity.ERROR
orOperationOutcome.IssueSeverity.FATAL
- Parameters:
oo
-OperationOutcome
to evaluate.- Returns:
Boolean.TRUE
if an error exists.
-
getManagedWebAccessor
-
withResourceFormat
-
withHeaders
-
withMessage
-
withRetryCount
-
withLogger
-
withTimeout
-
execute
- Throws:
IOException
-
executeAsBatch
- Throws:
IOException
-
unmarshalReference
protected <T extends Resource> T unmarshalReference(org.hl7.fhir.utilities.http.HTTPResult response, String format, String resourceType) Unmarshalls a resource from the response stream. -
unmarshalFeed
Unmarshalls Bundle from response stream. -
getParser
Returns the appropriate parser based on the format type passed in. Defaults to XML parser if a blank format is provided...because reasons. Currently supports only "json" and "xml" formats.- Parameters:
format
- One of "json" or "xml".- Returns:
JsonParser
orXmlParser
-
getLocationHeader
Extracts the 'location' header from the passed headers. If no value for 'location' exists, the value for 'content-location' is returned. If neither header exists, we return null.- Parameters:
headers
- Headers to search for 'location' or 'content-location'.
-