Class FHIRResource

    • Field Detail

      • HTTP_DATETIME_FORMATTER

        public static final DateTimeFormatter HTTP_DATETIME_FORMATTER
      • context

        @Context
        protected javax.servlet.ServletContext context
      • httpServletRequest

        @Context
        protected javax.servlet.http.HttpServletRequest httpServletRequest
      • uriInfo

        @Context
        protected javax.ws.rs.core.UriInfo uriInfo
        UriInfo injected by the JAXRS framework.

        Use getRequestUri() instead to get the original request URI when constructing URIs that will be sent back to the end user.

      • securityContext

        @Context
        protected javax.ws.rs.core.SecurityContext securityContext
    • Method Detail

      • checkInitComplete

        protected void checkInitComplete()
                                  throws FHIROperationException
        This method will do a quick check of the "initCompleted" flag in the servlet context. If the flag is FALSE, then we'll throw an error to short-circuit the current in-progress REST API invocation.
        Throws:
        FHIROperationException
      • checkType

        protected void checkType​(String type)
                          throws FHIROperationException
        This method will do a quick check of the {type} URL parameter. If the type is not a valid FHIR resource type, then we'll throw an error to short-circuit the current in-progress REST API invocation.
        Throws:
        FHIROperationException
      • parseIfModifiedSince

        protected long parseIfModifiedSince()
      • getAbsoluteUri

        protected String getAbsoluteUri​(String baseUri,
                                        String relativeUri)
        This function will build an absolute URI from the specified base URI and relative URI.
        Parameters:
        baseUri - the base URI to be used; this will be of the form ://:/
        relativeUri - the path and query parts
        Returns:
        the full URI value as a String
      • addHeaders

        protected javax.ws.rs.core.Response.ResponseBuilder addHeaders​(javax.ws.rs.core.Response.ResponseBuilder rb,
                                                                       Resource resource)
        Adds the Etag and Last-Modified headers to the specified response object.
      • exceptionResponse

        protected javax.ws.rs.core.Response exceptionResponse​(FHIROperationException e,
                                                              javax.ws.rs.core.Response.Status status)
      • exceptionResponse

        protected javax.ws.rs.core.Response exceptionResponse​(Exception e,
                                                              javax.ws.rs.core.Response.Status status)
      • exceptionResponse

        protected javax.ws.rs.core.Response exceptionResponse​(OperationOutcome oo,
                                                              javax.ws.rs.core.Response.Status status)
      • isUpdateCreateEnabled

        protected Boolean isUpdateCreateEnabled()
      • getRequestUri

        protected String getRequestUri()
                                throws Exception
        Get the original request URI from either the HttpServletRequest or a configured Header (in case of re-writing proxies).

        When the 'fhirServer/core/originalRequestUriHeaderName' property is empty, this method returns the equivalent of uriInfo.getRequestUri().toString(), except that uriInfo.getRequestUri() will throw an IllegalArgumentException when the query string portion contains a vertical bar | character. The vertical bar is one known case of a special character causing the exception. There could be others.

        Returns:
        String The complete request URI
        Throws:
        Exception - if an error occurs while reading the config
      • getRequestBaseUri

        protected String getRequestBaseUri​(String type)
                                    throws Exception
        This method returns the "base URI" associated with the current request. For example, if a client invoked POST https://myhost:9443/fhir-server/api/v4/Patient to create a Patient resource, this method would return "https://myhost:9443/fhir-server/api/v4".
        Returns:
        The base endpoint URI associated with the current request.
        Throws:
        Exception - if an error occurs while reading the config
      • toUri

        protected URI toUri​(String uriString)
                     throws URISyntaxException
        This method simply returns a URI object containing the specified URI string.
        Parameters:
        uriString - the URI string for which the URI object will be created
        Throws:
        URISyntaxException
      • buildUnsupportedResourceTypeException

        protected FHIROperationException buildUnsupportedResourceTypeException​(String resourceTypeName)