Package ca.uhn.fhir.rest.api.server
Class RequestDetails
java.lang.Object
ca.uhn.fhir.rest.api.server.RequestDetails
- Direct Known Subclasses:
ServletRequestDetails
,SystemRequestDetails
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRequestDetails
(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) ConstructorRequestDetails
(RequestDetails theRequestDetails) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Adds a new headervoid
addParameter
(String theName, String[] theValues) abstract Object
getAttribute
(String theAttributeName) Returns the attribute map for this request.protected abstract byte[]
abstract Charset
Return 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, ornull
otherwise.abstract ca.uhn.fhir.context.FhirContext
Returns the HAPI FHIR Context associated with this requestThe fhir server base url, independant of the query being executedabstract String
getHeaders
(String name) org.hl7.fhir.instance.model.api.IIdType
getId()
abstract InputStream
Retrieves the body of the request as binary data.ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster
Returns an invoker that can be called from user code to advise the server interceptors of any nested operations being invoked within operations.int
abstract Reader
Retrieves the body of the request as character data using aBufferedReader
.byte[]
Returns the request contents if they were loaded, returnsnull
otherwiseThe part of the request URL that comes after the server base.ca.uhn.fhir.util.StopWatch
ca.uhn.fhir.rest.api.RequestTypeEnum
org.hl7.fhir.instance.model.api.IBaseResource
Returns the request resource (as provided in the request body) if it has been parsed.ca.uhn.fhir.rest.api.RestOperationTypeEnum
abstract IRestfulServerDefaults
abstract String
Deprecated.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.boolean
boolean
isRetry()
boolean
boolean
Is this request a sub-request (i.e.final byte[]
void
removeParameter
(String theName) abstract void
setAttribute
(String theAttributeName, Object theAttributeValue) Returns the attribute map for this request.void
setCompartmentName
(String theCompartmentName) void
setCompleteUrl
(String theCompleteUrl) void
setFhirServerBase
(String theFhirServerBase) void
setFixedConditionalUrl
(String theFixedConditionalUrl) abstract void
setHeaders
(String theName, List<String> theValue) Replaces any existing header(s) with the given name using a List of new header valuesvoid
setId
(org.hl7.fhir.instance.model.api.IIdType theId) void
setMaxRetries
(int theMaxRetries) void
setOperation
(String theOperation) void
setParameters
(Map<String, String[]> theParams) void
setRequestContents
(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.void
setRequestId
(String theRequestId) void
setRequestPath
(String theRequestPath) void
setRequestType
(ca.uhn.fhir.rest.api.RequestTypeEnum theRequestType) void
setResource
(org.hl7.fhir.instance.model.api.IBaseResource theResource) Sets the request resource (as provided in the request body) if it has been parsed.void
setResourceName
(String theResourceName) void
setRespondGzip
(boolean theRespondGzip) void
setResponse
(IRestfulResponse theResponse) void
setRestOperationType
(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestOperationType) void
setRetry
(boolean theRetry) void
setRewriteHistory
(boolean theRewriteHistory) void
setSecondaryOperation
(String theSecondaryOperation) void
setSubRequest
(boolean theSubRequest) Is this request a sub-request (i.e.void
setTenantId
(String theTenantId) Sets the tenant ID associated with the request.void
setTransactionGuid
(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, ornull
otherwise. 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-Exist
header.- Parameters:
theOperationType
- The operation type to find the conditional URL for- Returns:
- Returns the conditional URL if this request has one, or
null
otherwise
-
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
Returns the attribute map for this request. Attributes are a place for user-supplied objects of any type to be attached to an individual request. They can be used to pass information between interceptor methods. -
setAttribute
Returns the attribute map for this request. Attributes are a place for user-supplied objects of any type to be attached to an individual request. They can be used to pass information between interceptor methods. -
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
InputStream
object 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
Reader
containing 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_PROCESSED
to a later hook method on thePointcut.SERVER_OUTGOING_RESPONSE
pointcut. -
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, returnsnull
otherwise- 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
-
getFhirServerBase()
instead.