Package ca.uhn.fhir.rest.server
Class RestfulServerUtils
java.lang.Object
ca.uhn.fhir.rest.server.RestfulServerUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classReturn type fordetermineRequestEncodingNoDefault(RequestDetails) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureResponseParser(RequestDetails theRequestDetails, ca.uhn.fhir.parser.IParser parser)static StringcreateEtag(String theVersionId)static StringcreateLinkSelf(String theServerBase, RequestDetails theRequest)static StringcreateLinkSelfWithoutGivenParameters(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 StringcreateOffsetPagingLink(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, String requestPath, String tenantId, Integer theOffset, Integer theCount, Map<String,String[]> theRequestParameters)static StringcreatePagingLink(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, RequestDetails theRequestDetails, String theSearchId, int theOffset, int theCount, Map<String,String[]> theRequestParameters)static StringcreatePagingLink(ca.uhn.fhir.rest.api.BundleLinks theBundleLinks, RequestDetails theRequestDetails, String theSearchId, String thePageId, Map<String,String[]> theRequestParameters)static ca.uhn.fhir.rest.api.EncodingEnumstatic ca.uhn.fhir.rest.api.EncodingEnumdetermineRequestEncodingNoDefault(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 IntegerextractCountParameter(RequestDetails theRequest)static ca.uhn.fhir.rest.api.DeleteCascadeModeEnumextractDeleteCascadeParameter(RequestDetails theRequest)static org.hl7.fhir.instance.model.api.IPrimitiveType<Date>extractLastUpdatedFromResource(org.hl7.fhir.instance.model.api.IBaseResource theResource)static IntegerextractOffsetParameter(RequestDetails theRequest)static org.hl7.fhir.instance.model.api.IIdTypefullyQualifyResourceIdOrReturnNull(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.IParsergetNewParser(ca.uhn.fhir.context.FhirContext theContext, ca.uhn.fhir.context.FhirVersionEnum theForVersion, RequestDetails theRequestDetails)parseAcceptHeaderAndReturnHighestRankedOptions(javax.servlet.http.HttpServletRequest theRequest)static ca.uhn.fhir.rest.api.PreferHeaderparsePreferHeader(IRestfulServer<?> theServer, String theValue)static booleanprettyPrintResponse(IRestfulServerDefaults theServer, RequestDetails theRequest)static booleanrespectPreferHeader(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestOperationType)static ObjectstreamResponseAsResource(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, Set<ca.uhn.fhir.rest.api.SummaryEnum> theSummaryMode, int stausCode, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails)static ObjectstreamResponseAsResource(IRestfulServerDefaults theServer, org.hl7.fhir.instance.model.api.IBaseResource theResource, Set<ca.uhn.fhir.rest.api.SummaryEnum> theSummaryMode, int theStatusCode, String theStatusMessage, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IIdType theOperationResourceId, org.hl7.fhir.instance.model.api.IPrimitiveType<Date> theOperationResourceLastUpdated)static IntegertryToExtractNamedParameter(RequestDetails theRequest, String theParamName)static voidvalidateResourceListNotNull(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(javax.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 stausCode, 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, String theStatusMessage, 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 ca.uhn.fhir.rest.api.DeleteCascadeModeEnum extractDeleteCascadeParameter(RequestDetails theRequest)- Since:
- 5.0.0
-