
Class RequestDetails
- Direct Known Subclasses:
ServletRequestDetails,SystemRequestDetails
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRequestDetails(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) ConstructorRequestDetails(RequestDetails theRequestDetails) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAdds a new headervoidaddParameter(String theName, String[] theValues) getAttribute(String theAttributeName) Deprecated.protected abstract byte[]abstract CharsetReturn the charset as defined by the header contenttype.getConditionalUrl(ca.uhn.fhir.rest.api.RestOperationTypeEnum theOperationType) Returns the conditional URL if this request has one, ornullotherwise.abstract ca.uhn.fhir.context.FhirContextReturns the HAPI FHIR Context associated with this requestThe fhir server base url, independant of the query being executedabstract StringgetHeaders(String name) org.hl7.fhir.instance.model.api.IIdTypegetId()abstract InputStreamRetrieves the body of the request as binary data.ca.uhn.fhir.interceptor.api.IInterceptorBroadcasterReturns an invoker that can be called from user code to advise the server interceptors of any nested operations being invoked within operations.intabstract ReaderRetrieves the body of the request as character data using aBufferedReader.byte[]Returns the request contents if they were loaded, returnsnullotherwiseThe part of the request URL that comes after the server base.ca.uhn.fhir.util.StopWatchca.uhn.fhir.rest.api.RequestTypeEnumorg.hl7.fhir.instance.model.api.IBaseResourceReturns the request resource (as provided in the request body) if it has been parsed.ca.uhn.fhir.rest.api.RestOperationTypeEnumabstract IRestfulServerDefaultsabstract StringDeprecated.UsegetFhirServerBase()instead.Gets the tenant ID associated with the request.Returns a map which can be used to hold any user specific data to pass it from one part of the request handling chain to another.booleanbooleanbooleanisRetry()booleanbooleanIs this request a sub-request (i.e. a request within a batch or transaction)?final byte[]voidremoveParameter(String theName) voidsetAttribute(String theAttributeName, Object theAttributeValue) Deprecated.UsegetUserData().voidsetCompartmentName(String theCompartmentName) voidsetCompleteUrl(String theCompleteUrl) voidsetFhirServerBase(String theFhirServerBase) voidsetFixedConditionalUrl(String theFixedConditionalUrl) abstract voidsetHeaders(String theName, List<String> theValue) Replaces any existing header(s) with the given name using a List of new header valuesvoidsetId(org.hl7.fhir.instance.model.api.IIdType theId) voidsetMaxRetries(int theMaxRetries) voidsetOperation(String theOperation) voidsetParameters(Map<String, String[]> theParams) voidsetRequestContents(byte[] theRequestContents) This method may be used to modify the contents of the incoming request by hardcoding a value which will be used instead of the value received by the client.voidsetRequestId(String theRequestId) voidsetRequestPath(String theRequestPath) voidsetRequestType(ca.uhn.fhir.rest.api.RequestTypeEnum theRequestType) voidsetResource(org.hl7.fhir.instance.model.api.IBaseResource theResource) Sets the request resource (as provided in the request body) if it has been parsed.voidsetResourceName(String theResourceName) voidsetRespondGzip(boolean theRespondGzip) voidsetResponse(IRestfulResponse theResponse) voidsetRestOperationType(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestOperationType) voidsetRetry(boolean theRetry) voidsetRewriteHistory(boolean theRewriteHistory) voidsetSecondaryOperation(String theSecondaryOperation) voidsetSubRequest(boolean theSubRequest) Is this request a sub-request (i.e. a request within a batch or transaction)?voidsetTenantId(String theTenantId) Sets the tenant ID associated with the request.voidsetTransactionGuid(String theTransactionGuid)
-
Field Details
-
BAD_STREAM_PLACEHOLDER
-
-
Constructor Details
-
RequestDetails
public RequestDetails(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) Constructor -
RequestDetails
Copy constructor
-
-
Method Details
-
getFixedConditionalUrl
-
setFixedConditionalUrl
-
getRequestId
-
setRequestId
-
getRequestStopwatch
-
getResource
Returns the request resource (as provided in the request body) if it has been parsed. Note that this value is only set fairly late in the processing pipeline, so it may not always be set, even for operations that take a resource as input.- Since:
- 4.0.0
-
setResource
Sets the request resource (as provided in the request body) if it has been parsed. Note that this value is only set fairly late in the processing pipeline, so it may not always be set, even for operations that take a resource as input.- Since:
- 4.0.0
-
addParameter
-
getByteStreamRequestContents
-
getCharset
Return the charset as defined by the header contenttype. Return null if it is not set. -
getCompartmentName
-
setCompartmentName
-
getCompleteUrl
-
setCompleteUrl
-
getConditionalUrl
Returns the conditional URL if this request has one, ornullotherwise. For an update or delete method, this is the part of the URL after the?. For a create, this is the value of theIf-None-Existheader.- Parameters:
theOperationType- The operation type to find the conditional URL for- Returns:
- Returns the conditional URL if this request has one, or
nullotherwise
-
getFhirContext
Returns the HAPI FHIR Context associated with this request -
getFhirServerBase
The fhir server base url, independant of the query being executed- Returns:
- the fhir server base url
-
setFhirServerBase
-
getHeader
-
getHeaders
-
addHeader
Adds a new header- Parameters:
theName- The header nametheValue- The header value- Since:
- 7.2.0
-
setHeaders
Replaces any existing header(s) with the given name using a List of new header values- Parameters:
theName- The header nametheValue- The header value- Since:
- 7.2.0
-
getId
-
setId
-
getAttribute
Deprecated.UsegetUserData(). If servlet attributes are truly required, then useIHasServletAttributes.getServletAttribute(String). -
setAttribute
Deprecated.UsegetUserData(). If servlet attributes are truly required, then useIHasServletAttributes.setServletAttribute(String, Object). -
getInputStream
Retrieves the body of the request as binary data. Either this method orgetReader()may be called to read the body, not both.- Returns:
- a
InputStreamobject containing the body of the request - Throws:
IllegalStateException- if thegetReader()method has already been called for this requestIOException- if an input or output exception occurred
-
getOperation
-
setOperation
-
getParameters
-
setParameters
-
getReader
Retrieves the body of the request as character data using aBufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method orgetInputStream()may be called to read the body, not both.- Returns:
- a
Readercontaining the body of the request - Throws:
UnsupportedEncodingException- if the character set encoding used is not supported and the text cannot be decodedIllegalStateException- ifgetInputStream()method has been called on this requestIOException- if an input or output exception occurred- See Also:
-
getInterceptorBroadcaster
Returns an invoker that can be called from user code to advise the server interceptors of any nested operations being invoked within operations. This invoker acts as a proxy for all interceptors -
getRequestPath
The part of the request URL that comes after the server base.Will not contain a leading '/'
-
setRequestPath
-
getRequestType
-
setRequestType
-
getResourceName
-
setResourceName
-
getResponse
-
setResponse
-
getRestOperationType
-
setRestOperationType
-
getSecondaryOperation
-
setSecondaryOperation
-
getServer
-
getServerBaseForRequest
Deprecated.UsegetFhirServerBase()instead. Deprecated in HAPI FHIR 7.0.0Returns the server base URL (with no trailing '/') for a given request -
getTenantId
Gets the tenant ID associated with the request. Note that the tenant ID and the partition ID are not the same thing - Depending on the specific partition interceptors in use, the tenant ID might be used internally to derive the partition ID or it might not. Do not assume that it will be used for this purpose. -
setTenantId
Sets the tenant ID associated with the request. Note that the tenant ID and the partition ID are not the same thing - Depending on the specific partition interceptors in use, the tenant ID might be used internally to derive the partition ID or it might not. Do not assume that it will be used for this purpose. -
getUnqualifiedToQualifiedNames
-
getUserData
Returns a map which can be used to hold any user specific data to pass it from one part of the request handling chain to another. Data in this map can use any key, although user code should try to use keys which are specific enough to avoid conflicts.A new map is created for each individual request that is handled by the server, so this map can be used (for example) to pass authorization details from an interceptor to the resource providers, or for example to pass data from a hook method on the
Pointcut.SERVER_INCOMING_REQUEST_POST_PROCESSEDto a later hook method on thePointcut.SERVER_OUTGOING_RESPONSEpointcut.This method should be used to pass information between interceptor methods. For servlet-specific request attributes used to communicate between servlet filters, use
IHasServletAttributesmethods available on implementations that support them. -
isRespondGzip
-
setRespondGzip
-
isSubRequest
Is this request a sub-request (i.e. a request within a batch or transaction)? This flag is used internally by hapi-fhir-jpaserver-base, but not used in the plain server library. You may use it in your client code as a hint when implementing transaction logic in the plain server.Defaults to false
-
setSubRequest
Is this request a sub-request (i.e. a request within a batch or transaction)? This flag is used internally by hapi-fhir-jpaserver-base, but not used in the plain server library. You may use it in your client code as a hint when implementing transaction logic in the plain server.Defaults to false
-
loadRequestContents
-
getRequestContentsIfLoaded
Returns the request contents if they were loaded, returnsnullotherwise- See Also:
-
removeParameter
-
setRequestContents
This method may be used to modify the contents of the incoming request by hardcoding a value which will be used instead of the value received by the client.This method is useful for modifying the request body prior to parsing within interceptors. It generally only has an impact when called in the
IServerInterceptor.incomingRequestPostProcessed(RequestDetails, HttpServletRequest, HttpServletResponse)method -
getTransactionGuid
-
setTransactionGuid
-
isRewriteHistory
-
setRewriteHistory
-
getMaxRetries
-
setMaxRetries
-
isRetry
-
setRetry
-
isPreferAsync
-
getUserData().