Show TOC

Multipart RequestsLocate this document in the navigation structure

Definition

It is possible to transfer multiple content (i.e. several files in case of a file upload to a server) whithin one request entity, which is then called a multipar t entity. When doing so, a REST client can save the overhead of sending a sequence of single requests to the server (which reduces network latency and so on).

The REST library offers functionality to ease building and consuming those multipart contents:

  1. Support for packing/unpacking multiple data into one entity

  2. Support for sending multiple fully qualified HTTP requests/responses into one entity. A fully qualified HTTP requests/response means request line/status line + HTTP header + HTTP entity.

This chapter focuses on point 2. For point 1 please refer to the documentation of class CL_REST_MP_FORM_DATA .

  • a multipart request is a REST request containing several packed REST requests inside its entity.

  • a multipart response is a REST response containing several packed REST responses inside its entity.

The characteristics of sending multiple fully qualified HTTP requests/responses is:

  • The URI of the multipart request does not identify a single resource any more but is generic because it serves for multiple requests.

  • The HTTP entity of a multipart request contains multiple parts each of them a single REST request. Because an arbitrary set of methods can be used inside a multipart request, the HTTP POST method gets regularly used to transfer such a multipart request to the server.

    This has the disadvantage, that for network intermediates (like proxies, reverse proxies, caches, and so on) the operation is not transparent anymore, so this kind of request cannot make use of them (for example, for caching purposes).

  • Because multiple requests in the specified sequence can have different results, the server does not have any means to report the overall result to the client, but code the results inside the HTTP entity. This also makes it invisible to network intermediates.

    To ease that characteristic of multipart processing, a multipart request can be send to a server proxy, which splits it into separate requests so the processing becomes again a single request processing, where each URI identifies again a single resource having a unique HTTP method.