Class RequestDetails
- Direct Known Subclasses:
ServletRequestDetails
-
Constructor Summary
ConstructorsConstructorDescriptionRequestDetails(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) ConstructorRequestDetails(ServletRequestDetails theRequestDetails) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(String theName, String[] theValues) abstract ObjectgetAttribute(String theAttributeName) Returns the attribute map for this request.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.abstract 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 StringReturns the server base URL (with no trailing '/') for a given requestReturns 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.booleanbooleanIs this request a sub-request (i.e.final byte[]voidremoveParameter(String theName) abstract voidsetAttribute(String theAttributeName, Object theAttributeValue) Returns the attribute map for this request.voidsetCompartmentName(String theCompartmentName) voidsetCompleteUrl(String theCompleteUrl) voidsetFhirServerBase(String theFhirServerBase) voidsetFixedConditionalUrl(String theFixedConditionalUrl) voidsetId(org.hl7.fhir.instance.model.api.IIdType theId) 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) voidsetSecondaryOperation(String theSecondaryOperation) voidsetSubRequest(boolean theSubRequest) Is this request a sub-request (i.e.voidsetTenantId(String theTenantId) voidsetTransactionGuid(String theTransactionGuid)
-
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
-
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
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:
-
ServletRequest.getInputStream()
-
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
Returns the server base URL (with no trailing '/') for a given request -
getTenantId
-
setTenantId
-
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 from an interceptor's
IServerInterceptor.incomingRequestPreHandled(RestOperationTypeEnum, ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails)method to theIServerInterceptor.outgoingResponse(RequestDetails, org.hl7.fhir.instance.model.api.IBaseResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)method. -
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
-