
Package ca.uhn.fhir.rest.server.servlet
Class ServletRequestDetails
java.lang.Object
ca.uhn.fhir.rest.api.server.RequestDetails
ca.uhn.fhir.rest.server.servlet.ServletRequestDetails
- All Implemented Interfaces:
IHasServletAttributes
- Direct Known Subclasses:
ServletSubRequestDetails
-
Field Summary
Fields inherited from class ca.uhn.fhir.rest.api.server.RequestDetails
BAD_STREAM_PLACEHOLDER -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for testing onlyServletRequestDetails(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) ConstructorServletRequestDetails(ServletRequestDetails theRequestDetails) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new headergetAttribute(String theAttributeName) Deprecated.protected byte[]Return the charset as defined by the header contenttype.ca.uhn.fhir.context.FhirContextReturns the HAPI FHIR Context associated with this requestgetHeaders(String name) Retrieves the body of the request as binary data.Retrieves the body of the request as character data using aBufferedReader.Returns the server base URL (with no trailing '/') for a given requestgetServletAttribute(String theAttributeName) Gets an attribute from the servlet request.jakarta.servlet.http.HttpServletRequestjakarta.servlet.http.HttpServletResponsebooleanReturns true if the `Prefer` header contains a value of `respond-async`voidsetAttribute(String theAttributeName, Object theAttributeValue) Deprecated.voidsetHeaders(String theName, List<String> theValue) Replaces any existing header(s) with the given name using a List of new header valuesvoidsetServer(RestfulServer theServer) voidsetServletAttribute(String theAttributeName, Object theAttributeValue) Sets an attribute on the servlet request.setServletRequest(jakarta.servlet.http.HttpServletRequest myServletRequest) voidsetServletResponse(jakarta.servlet.http.HttpServletResponse myServletResponse) Methods inherited from class ca.uhn.fhir.rest.api.server.RequestDetails
addParameter, getCompartmentName, getCompleteUrl, getConditionalUrl, getFhirServerBase, getFixedConditionalUrl, getId, getInterceptorBroadcaster, getMaxRetries, getOperation, getParameters, getRequestContentsIfLoaded, getRequestId, getRequestPath, getRequestStopwatch, getRequestType, getResource, getResourceName, getResponse, getRestOperationType, getSecondaryOperation, getTenantId, getTransactionGuid, getUnqualifiedToQualifiedNames, getUserData, isPreferAsync, isRespondGzip, isRetry, isRewriteHistory, isSubRequest, loadRequestContents, removeParameter, setCompartmentName, setCompleteUrl, setFhirServerBase, setFixedConditionalUrl, setId, setMaxRetries, setOperation, setParameters, setRequestContents, setRequestId, setRequestPath, setRequestType, setResource, setResourceName, setRespondGzip, setResponse, setRestOperationType, setRetry, setRewriteHistory, setSecondaryOperation, setSubRequest, setTenantId, setTransactionGuid
-
Constructor Details
-
ServletRequestDetails
public ServletRequestDetails()Constructor for testing only -
ServletRequestDetails
public ServletRequestDetails(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) Constructor -
ServletRequestDetails
Copy constructor
-
-
Method Details
-
getByteStreamRequestContents
- Specified by:
getByteStreamRequestContentsin classRequestDetails
-
getCharset
Description copied from class:RequestDetailsReturn the charset as defined by the header contenttype. Return null if it is not set.- Specified by:
getCharsetin classRequestDetails
-
getFhirContext
Description copied from class:RequestDetailsReturns the HAPI FHIR Context associated with this request- Specified by:
getFhirContextin classRequestDetails
-
getHeader
- Specified by:
getHeaderin classRequestDetails
-
getHeaders
- Specified by:
getHeadersin classRequestDetails
-
addHeader
Description copied from class:RequestDetailsAdds a new header- Specified by:
addHeaderin classRequestDetails- Parameters:
theName- The header nametheValue- The header value
-
setHeaders
Description copied from class:RequestDetailsReplaces any existing header(s) with the given name using a List of new header values- Specified by:
setHeadersin classRequestDetails- Parameters:
theName- The header nametheValue- The header value
-
getServletAttribute
Gets an attribute from the servlet request. Attributes are used for interacting with servlet request attributes to communicate between servlet filters. These methods should not be used to pass information between interceptor methods. UseRequestDetails.getUserData()instead to pass information between interceptor methods.- Specified by:
getServletAttributein interfaceIHasServletAttributes- Parameters:
theAttributeName- The attribute name- Returns:
- The attribute value, or null if the attribute is not set
-
setServletAttribute
Sets an attribute on the servlet request. Attributes are used for interacting with servlet request attributes to communicate between servlet filters. These methods should not be used to pass information between interceptor methods. UseRequestDetails.getUserData()instead to pass information between interceptor methods.- Specified by:
setServletAttributein interfaceIHasServletAttributes- Parameters:
theAttributeName- The attribute nametheAttributeValue- The attribute value
-
getAttribute
Deprecated.UseRequestDetails.getUserData(). If servlet attributes are truly required, then useIHasServletAttributes.getServletAttribute(String).- Overrides:
getAttributein classRequestDetails
-
setAttribute
Deprecated.UseRequestDetails.getUserData(). If servlet attributes are truly required, then useIHasServletAttributes.setServletAttribute(String, Object).- Overrides:
setAttributein classRequestDetails
-
getInputStream
Description copied from class:RequestDetailsRetrieves the body of the request as binary data. Either this method orRequestDetails.getReader()may be called to read the body, not both.- Specified by:
getInputStreamin classRequestDetails- Returns:
- a
InputStreamobject containing the body of the request - Throws:
IOException- if an input or output exception occurred
-
getReader
Description copied from class:RequestDetailsRetrieves 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 orRequestDetails.getInputStream()may be called to read the body, not both.- Specified by:
getReaderin classRequestDetails- Returns:
- a
Readercontaining the body of the request - Throws:
IOException- if an input or output exception occurred- See Also:
-
getServer
- Specified by:
getServerin classRequestDetails
-
getServerBaseForRequest
Description copied from class:RequestDetailsReturns the server base URL (with no trailing '/') for a given request- Specified by:
getServerBaseForRequestin classRequestDetails
-
getServletRequest
-
getServletResponse
-
setServer
-
setServletRequest
public ServletRequestDetails setServletRequest(@Nonnull jakarta.servlet.http.HttpServletRequest myServletRequest) -
setServletResponse
-
getHeaders
-
isPreferRespondAsync
Returns true if the `Prefer` header contains a value of `respond-async`
-
RequestDetails.getUserData().