HS.FHIRServer.RestHandler

class HS.FHIRServer.RestHandler extends %CSP.REST

FHIR REST Handler

Method Inventory

Parameters

parameter CONVERTINPUTSTREAM = 1;
DefaultContentType specifies the content type to use when no content type is specified in the incoming request. The FHIR spec at http://www.hl7.org/fhir/STU3/http.html#mime-type is clear about defaulting if no acceptable format is specified via content negotiation: "If neither the accept header nor the _format parameter are specified, the MIME-type of the content returned by the server is undefined and may vary." Per the FHIR spec, "FHIR uses UTF-8 for all request and response bodies." (http://www.hl7.org/fhir/http.html#mime-type) Setting this parameter to 1 (the default in %CSP.Page is 0) will cause CSP to convert the request content to internal format before passing it to this handler (The equivalent of doing $ZCVT(val, "I", "UTF8") on the request content).
parameter DefaultContentType = JSON;
parameter HandleCorsRequest = 1;
This parameter influences the CORS support. The default is an empty string meaning 'not specified'. If set to true (1) then CORS processing is ON. If set to false (0) then CORS processing is OFF. If left unset "" then the decision to process CORS is delegated to the setting on the URL map route.
parameter IGNOREMISSINGCHARSETKEY = \FHIR\IgnoreMissingContentTypeCharset;
Per the FHIR spec, "requests and responses SHALL explicitly set the character encoding to UTF-8 using the charset parameter of the MIME-type in the Content-Type header" (http://www.hl7.org/fhir/http.html#mime-type). However what we have observed working with various FHIR clients is that clients sometimes include a Content-Type header in a request with no charset parameter. Setting the value of this key to 1 in the Configuration Registry in this namespace will cause a missing Content-Type charset to be ignored rather than rejected. A non-null charset that is not "utf8" or "utf-8" (case-insensitive) will still be rejected.
parameter PrivilegedPrefix = p;
If the first element of the FHIR request url is this string, then we flag the request as a population query request by setting AdditionalInfo("USER:PopulationQueryRequested") to 1. This allows for specialized Strategy code to handle population queries specially if desired.
parameter ServiceConfigName;
parameter isInteropAdapter = 0;

Methods

classmethod GetFormatForAccept(mimeType As %String) [ Language = objectscript ]
Translate valid values of the Accept header into a "format code"
classmethod GetFormatForContentType(mimeType As %String) [ Language = objectscript ]
Translate valid values of the Content-Type header into a "format code"
classmethod GetFormatForParameter(mimeType As %String) [ Language = objectscript ]
Translate valid values of the _format query parameter into a "format code"
classmethod GetRESTConfig() as HS.Util.RESTCSPConfig [ Language = objectscript ]
classmethod GetResponseMimeType(pResponseFormatCode As %String, ByRef toObject) [ Language = objectscript ]
@API Writes any returned content from the Response object to a stream, converting into the requested content format (json or xml). Sets the ContentType and CharSet properties in the specified'toObject'
classmethod IsRequestAuthenticated() [ Language = objectscript ]
classmethod OnHandleCorsRequest(pUrl As %String) as %Status [ Language = objectscript ]
OnHandleCorsRequest overrides the same method from %CSP.REST. FHIR CSP config setting DisableCORS provides a way for an implementation to override the HandleCorRequest class parameter.
classmethod OnHandleOptionsRequest(pUrl As %String) as %Status [ Language = objectscript ]
Called by %REST base class when an OPTIONS request is received. This method provides handling of the options request. Note carefully: If authentication is required then this method will be called before login and as such will have only limited privileges
classmethod WriteErrorResponse(json As %DynamicObject, pFHIRResponse As HS.FHIRServer.API.Data.Response, fhirService As HS.FHIRServer.Service, pOutStream As %Stream.Object, ByRef pMimeObj) [ Language = objectscript ]
classmethod WriteResponse(json As %DynamicObject, pResponseFormatCode As %String, isPretty As %Boolean, fhirService As HS.FHIRServer.Service, pOutStream As %Stream.Object, ByRef pMimeObj) [ Language = objectscript ]
classmethod WriteServiceResponse(pFHIRResponse As HS.FHIRServer.API.Data.Response, fhirService As HS.FHIRServer.Service, pOutStream As %Stream.Object, ByRef pMimeObj) [ Language = objectscript ]
classmethod determineInputFormatCode(pRequest As HS.FHIRServer.API.Data.Request) as %String [ Language = objectscript ]
Return the requested content format codes for the POSTed input data. The format codes are $$$FHIRContentCodeXML and $$$FHIRContentCodeJSON. The format of the input data (if any) is determined by the Content-Type header. This method analyzes the various acceptable Mime-Types and ensures that the CharSet is also proper. If the requested type is not supported, a 415 is returned for all FHIR versions. (Note: before R4, the return code was unspecified in the FHIR Spec). The spec says "... and 415 Unsupported Media Type when the client posts a format that is not supported to the server."
classmethod determineOutputFormatCode(pRequest As HS.FHIRServer.API.Data.Request) as %String [ Language = objectscript ]
Return the Format Code ($$$FHIRContentCodeJSON or $$$FHIRContentCodeXML) for the output data. 1. check for '_format' parameter. If present, use that. 2. check the "Accept" header. If present, use that. Require charset is utf-8 (if present). Allow non-presence of charset spec. NOTE: The STU3 spec was stricter, but R4 removes the strictness because it was a pain. we will follow the R4 spec for R3. 3. Use the default (from the configuration)
classmethod dispatchToEnsemble(pRequest As HS.FHIRServer.API.Data.Request) as %Status [ Language = objectscript ]
classmethod processRequest(pRequestPath As %String) as %Status [ Language = objectscript ]
Process an inbound request. This hands off the incoming request to the business service.
classmethod processSMARTDiscovery() [ Language = objectscript ]
Handle .well-known/smart-configuration. SMART info must be returned as application/json. Ensure that the Accept header specifies that. The behavior when SMART info is not avaiable is not defined by the spec. Therefore per our discretion, upon fail this method will return HTTP 500 and a JSON-formatted OperationOutcome resource.
Reference "SMART App Launch: Conformance" at: http://www.hl7.org/fhir/smart-app-launch/conformance/index.html
classmethod processWellKnown(pUriSuffix As %String) as %Status [ Language = objectscript ]

Inherited Members

Inherited Methods

Subclasses

Feedback