Package ca.uhn.fhir.rest.server
Class RestfulServerUtils
java.lang.Object
ca.uhn.fhir.rest.server.RestfulServerUtils
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Return type fordetermineRequestEncodingNoDefault(RequestDetails)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
configureResponseParser
(RequestDetails theRequestDetails, ca.uhn.fhir.parser.IParser parser) static String
createEtag
(String theVersionId) static String
createLinkSelf
(String theServerBase, RequestDetails theRequest) static String
createLinkSelfWithoutGivenParameters
(String theServerBase, RequestDetails theRequest, List<String> excludedParameterNames) This function will create a self link but omit any parameters passed in via the excludedParameterNames list.static String
createOffsetPagingLink
(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, String requestPath, String tenantId, Integer theOffset, Integer theCount, Map<String, String[]> theRequestParameters) static String
createPagingLink
(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, RequestDetails theRequestDetails, String theSearchId, int theOffset, int theCount, Map<String, String[]> theRequestParameters) static String
createPagingLink
(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, RequestDetails theRequestDetails, String theSearchId, String thePageId, Map<String, String[]> theRequestParameters) static ca.uhn.fhir.rest.api.EncodingEnum
static ca.uhn.fhir.rest.api.EncodingEnum
determineRequestEncodingNoDefault
(RequestDetails theReq, boolean theStrict) determineResponseEncodingNoDefault
(RequestDetails theReq, ca.uhn.fhir.rest.api.EncodingEnum thePrefer) Returns null if the request doesn't express that it wants FHIR.determineResponseEncodingNoDefault
(RequestDetails theReq, ca.uhn.fhir.rest.api.EncodingEnum thePrefer, String thePreferContentType) Try to determing the response content type, given the request Accept header and _format parameter.Determine whether a response should be given in JSON or XML format based on the incoming HttpServletRequest's"_format"
parameter and"Accept:"
HTTP header.static Set
<ca.uhn.fhir.rest.api.SummaryEnum> determineSummaryMode
(RequestDetails theRequest) static Integer
extractCountParameter
(RequestDetails theRequest) extractDeleteCascadeParameter
(RequestDetails theRequest) static org.hl7.fhir.instance.model.api.IPrimitiveType
<Date> extractLastUpdatedFromResource
(org.hl7.fhir.instance.model.api.IBaseResource theResource) static Integer
extractOffsetParameter
(RequestDetails theRequest) static org.hl7.fhir.instance.model.api.IIdType
fullyQualifyResourceIdOrReturnNull
(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, String theServerBase, org.hl7.fhir.instance.model.api.IIdType theResourceId) static ca.uhn.fhir.parser.IParser
getNewParser
(ca.uhn.fhir.context.FhirContext theContext, ca.uhn.fhir.context.FhirVersionEnum theForVersion, RequestDetails theRequestDetails) parseAcceptHeaderAndReturnHighestRankedOptions
(jakarta.servlet.http.HttpServletRequest theRequest) static ca.uhn.fhir.rest.api.PreferHeader
parsePreferHeader
(IRestfulServer<?> theServer, String theValue) static boolean
prettyPrintResponse
(IRestfulServerDefaults theServer, RequestDetails theRequest) static boolean
respectPreferHeader
(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestOperationType) static Object
streamResponseAsResource
(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, Set<ca.uhn.fhir.rest.api.SummaryEnum> theSummaryMode, int theStatusCode, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails) static Object
streamResponseAsResource
(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, Set<ca.uhn.fhir.rest.api.SummaryEnum> theSummaryMode, int theStatusCode, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IIdType theOperationResourceId, org.hl7.fhir.instance.model.api.IPrimitiveType<Date> theOperationResourceLastUpdated) static Integer
tryToExtractNamedParameter
(RequestDetails theRequest, String theParamName) static void
validateResourceListNotNull
(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theResourceList)
-
Constructor Details
-
RestfulServerUtils
public RestfulServerUtils()
-
-
Method Details
-
configureResponseParser
public static void configureResponseParser(RequestDetails theRequestDetails, ca.uhn.fhir.parser.IParser parser) -
createLinkSelf
-
createLinkSelfWithoutGivenParameters
public static String createLinkSelfWithoutGivenParameters(String theServerBase, RequestDetails theRequest, List<String> excludedParameterNames) This function will create a self link but omit any parameters passed in via the excludedParameterNames list. -
createOffsetPagingLink
-
createPagingLink
public static String createPagingLink(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, RequestDetails theRequestDetails, String theSearchId, int theOffset, int theCount, Map<String, String[]> theRequestParameters) -
createPagingLink
public static String createPagingLink(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, RequestDetails theRequestDetails, String theSearchId, String thePageId, Map<String, String[]> theRequestParameters) -
determineRequestEncodingNoDefault
@Nullable public static ca.uhn.fhir.rest.api.EncodingEnum determineRequestEncodingNoDefault(RequestDetails theReq) -
determineRequestEncodingNoDefault
@Nullable public static ca.uhn.fhir.rest.api.EncodingEnum determineRequestEncodingNoDefault(RequestDetails theReq, boolean theStrict) -
determineResponseEncodingNoDefault
public static RestfulServerUtils.ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, ca.uhn.fhir.rest.api.EncodingEnum thePrefer) Returns null if the request doesn't express that it wants FHIR. If it expresses that it wants XML and JSON equally, returns thePrefer. -
determineResponseEncodingNoDefault
public static RestfulServerUtils.ResponseEncoding determineResponseEncodingNoDefault(RequestDetails theReq, ca.uhn.fhir.rest.api.EncodingEnum thePrefer, String thePreferContentType) Try to determing the response content type, given the request Accept header and _format parameter. If a value is provided to thePreferContents, we'll prefer to return that value over the native FHIR value. -
determineResponseEncodingWithDefault
public static RestfulServerUtils.ResponseEncoding determineResponseEncodingWithDefault(RequestDetails theReq) Determine whether a response should be given in JSON or XML format based on the incoming HttpServletRequest's"_format"
parameter and"Accept:"
HTTP header. -
determineSummaryMode
@Nonnull public static Set<ca.uhn.fhir.rest.api.SummaryEnum> determineSummaryMode(RequestDetails theRequest) -
extractCountParameter
-
extractOffsetParameter
-
extractLastUpdatedFromResource
public static org.hl7.fhir.instance.model.api.IPrimitiveType<Date> extractLastUpdatedFromResource(org.hl7.fhir.instance.model.api.IBaseResource theResource) -
fullyQualifyResourceIdOrReturnNull
public static org.hl7.fhir.instance.model.api.IIdType fullyQualifyResourceIdOrReturnNull(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, String theServerBase, org.hl7.fhir.instance.model.api.IIdType theResourceId) -
getNewParser
public static ca.uhn.fhir.parser.IParser getNewParser(ca.uhn.fhir.context.FhirContext theContext, ca.uhn.fhir.context.FhirVersionEnum theForVersion, RequestDetails theRequestDetails) -
parseAcceptHeaderAndReturnHighestRankedOptions
public static Set<String> parseAcceptHeaderAndReturnHighestRankedOptions(jakarta.servlet.http.HttpServletRequest theRequest) -
respectPreferHeader
public static boolean respectPreferHeader(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestOperationType) -
parsePreferHeader
@Nonnull public static ca.uhn.fhir.rest.api.PreferHeader parsePreferHeader(IRestfulServer<?> theServer, String theValue) -
prettyPrintResponse
public static boolean prettyPrintResponse(IRestfulServerDefaults theServer, RequestDetails theRequest) -
streamResponseAsResource
public static Object streamResponseAsResource(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, Set<ca.uhn.fhir.rest.api.SummaryEnum> theSummaryMode, int theStatusCode, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails) throws IOException - Throws:
IOException
-
streamResponseAsResource
public static Object streamResponseAsResource(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, Set<ca.uhn.fhir.rest.api.SummaryEnum> theSummaryMode, int theStatusCode, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IIdType theOperationResourceId, org.hl7.fhir.instance.model.api.IPrimitiveType<Date> theOperationResourceLastUpdated) throws IOException - Throws:
IOException
-
createEtag
-
tryToExtractNamedParameter
-
validateResourceListNotNull
public static void validateResourceListNotNull(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theResourceList) -
extractDeleteCascadeParameter
public static RestfulServerUtils.DeleteCascadeDetails extractDeleteCascadeParameter(RequestDetails theRequest) - Since:
- 5.0.0
-