
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.HTTPRequestformatHeaders(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 inHTTPHeaders to the passed inHTTPRequestprotected static StringgetLocationHeader(Iterable<org.hl7.fhir.utilities.http.HTTPHeader> headers) Extracts the 'location' header from the passedIterable<org.hl7.fhir.utilities.http.HTTPHeader>.protected org.hl7.fhir.utilities.http.ManagedFhirWebAccessorprotected IParserReturns 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 booleanReturns true if any of theOperationOutcome.OperationOutcomeIssueComponentwithin the providedOperationOutcomehave anOperationOutcome.IssueSeverityofOperationOutcome.IssueSeverity.ERRORorOperationOutcome.IssueSeverity.FATALprotected BundleunmarshalFeed(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
-
LOCATION_HEADER
- See Also:
-
CONTENT_LOCATION_HEADER
- See Also:
-
DEFAULT_CHARSET
- 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 inHTTPHeaders to the passed inHTTPRequest- Parameters:
request-HTTPRequestto add headers to.format- ExpectedResourceformat.headers- Any additionalHTTPHeaders 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-HTTPRequestto add default headers to.format- ExpectedResourceformat.
-
hasError
Returns true if any of theOperationOutcome.OperationOutcomeIssueComponentwithin the providedOperationOutcomehave anOperationOutcome.IssueSeverityofOperationOutcome.IssueSeverity.ERRORorOperationOutcome.IssueSeverity.FATAL- Parameters:
oo-OperationOutcometo evaluate.- Returns:
Boolean.TRUEif an error exists.
-
getLocationHeader
Extracts the 'location' header from the passedIterable<org.hl7.fhir.utilities.http.HTTPHeader>. If no value for 'location' exists, the value for 'content-location' is returned. If neither header exists, we return null.- Parameters:
headers-HTTPHeaderto evaluate- Returns:
Stringheader value, or null if no location headers are set.
-
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:
JsonParserorXmlParser
-