DICOM PS3.18 2024e - Web Services |
---|
Both request and response messages may have message bodies. The message body (if any) of an HTTP message is used to carry the payload of the message. The message body is identical to the payload unless a content coding has been applied, as described in [RFC7230] Section 3.3.1. This Part of the Standard uses the term "payload" to denote the message body before any content coding has been applied to it.
A message may or may not have a payload. A payload may be empty; that is, its length is zero. If a message has no payload, then the message shall have neither Transfer-Encoding nor Content-Length Header Fields. If a message has a payload to which a transfer-coding has been applied, then the message shall have a Transfer-Encoding Header Field. If a message has a payload that has not had a transfer-coding applied, then the message shall have a Content-Length Header Field.
Any message containing a payload shall have appropriate Content Representation [RFC7231] Section 3.1 and Payload Header Fields [RFC7231] Section 3.3.
Payloads contain representations. Payloads may be single part or multipart.
The message Content-Type Header Field contains a Media Type that includes multipart/related when the payload is multipart, otherwise the payload is single part.
A message with a single part payload contains one representation that is described by the Content Representation Header Fields (see Section 8.4.3) contained in the message header.
A message with a single part payload shall have a Content-Type Header Field with a single part media-type (see Section 8.7.3).
Single part payloads may be requested with an HTTP Range [RFC7233] request. If supported by the server, the response shall be according to the standard HTTP Range [RFC7233] response.
A single part payload is only applicable for requests that return exactly one item. Such responses may also be encoded as a multipart payload with a single item in them, as determined by Table 10.4.4-1.
A message with a multipart payload contains zero or more representations. Each representation goes in a separate part.
A message with a multipart payload shall have a Content-Type Header Field with a multipart media-type.
The Media Type of the root representation (see [RFC2387]) may be specified by the Content-Type Header Field of the message. If no root parameter is specified, then the root representation is the first representation in the payload.
Each part in a multipart payload shall start with a boundary string, followed by a Content-Type Header Field with a single part Media Type (see Section 8.7.3), followed by other fields as specified in Table 8.6.1-1. See also Figure 8.6-1. Other Header Fields may be included.
Understanding the nature of an encoded Bulkdata resource may depend on the corresponding Metadata reference to the bulkdataURI and is not necessarily implicit in the Content-Type Header Field.
An HTTP Range [RFC7233] request may be used with Multipart payloads, but the range applies to the entire response, including the multipart markers. In order for the response to be valid across requests, the ordering of items and the choice of multipart separator must remain the same.
The Content-Location is used to identify the specific resource (e.g. down to the level of a specific frame or instance or bulkdataURI) represented in this part. This allows the payload recipient to distinguish the parts, for example when each part contains a different frame of a requested Multi-frame Instance.
Table 8.6.1-1. Multipart Header Fields
Shall be present if the response payload does not have a transfer encoding |
|||
Shall be present if the response payload contains a representation of a resource. See [RFC7231] Section 3.1.4.2. |
|||
See [RFC7231] Section 7.1.2. |
See Section 8.7.1 and [RFC7231].
The following is an example template of a multipart request or response message that has a multipart payload:
request-line / response-line
Content-Type: multipart-media-type CRLF
Content-Location: "/" {/url} CRLF
*(header-field CRLF)
CRLF
multipart-payload
The Content-Type Header Field shall have a multipart media-type. For example:
Content-Type: multipart/related; type=DQUOTE root-media-type DQUOTE; boundary="---boundary---"
multipart-media-type |
is a Media Type defined by [RFC2387]. |
root-media-type |
is a single part Media Type that specifies the Media Type of the root, typically the first part, in the payload. If the value of the type parameter and the root body part's content-type differ then the user agent's behavior is undefined. |
boundary |
specifies a string that acts as a boundary between message parts. |
If a multipart payload contains representations of Metadata (see Section 8.7.3.3.1), and Bulkdata (see Section 8.7.3.3.2), then all Metadata message parts that reference a Bulkdata part shall precede the referenced Bulkdata part. The Content-Location of the Bulkdata part shall contain the corresponding BulkDataURI used in the referencing Metadata.
Figure 8.6-1 shows the correspondence between the IOD representation and a multipart payload.
The syntax of a multipart payload is:
multipart-payload = 1*(DASH boundary CRLF part CRLF) DASH boundary DASH
DASH = "--" boundary = 0*69(bchar / SP) bchar bchar = DIGIT / ALPHA / "'" / "(" / ")" / "+" / "_" ; The legal boundary characters / "," / "-" / "." / "/" / ":" / "=" / "?" part = Content-Type: media-type CRLF Content-Location: url CRLF (Content-Length: uint CRLF / Transfer-Encoding: encoding CRLF) [Content-Description: text CRLF] *(header-field CRLF) CRLF part-payload part-payload = *OCTET
For example, if the boundary is "++++", then a message payload containing three parts would be structured as follows:
--++++CRLF
Content-Type: media-type CRLF
Content-Location: url CRLF
(Content-Length: uint CRLF / Transfer-Encoding: encoding CRLF)
[Content-Description: {description} CRLF]
CRLF
payload CRLF
--++++CRLF
Content-Type: media-type CRLF
. . .
payload CRLF
--++++CRLF
Content-Type: media-type CRLF
. . .
payload CRLF
--++++--
DICOM PS3.18 2024e - Web Services |
---|