Previous: , Up: Client   [Contents][Index]


4.2 Saving to Server

There isn’t much here yet. Maybe you can help?

To save changes, the client posts only the bucket diff (see Bucket Diff) to the Server (see Server). Because JSON serialization encodes undefined values as null (as noted in Bucket Diff), and only the null in the tail position marks the truncation point, the Client first truncates the array to include only the first null.9 An example is shown in Figure 4.1.

  // given (two unchanged, three removed)
  [ undefined, undefined, null, null, null ]

  // encodes into JSON as (bad; represents four unchanged, one removed)
  [ null, null, null, null, null ]

  // Client truncates to (two unchanged, >=2 removed)
  [ null, null, null ]

Figure 4.1: Client diff truncation

This conversion is handled by XhttpQuoteTransport. Examples can be found in the respective test case XhttpQuoteTransport.


Footnotes

(9)

The server would otherwise remove only the last index, even if multiple indexes were removed.