REST gateway: HTTP sessions and cookies

Use HTTP sessions and cookies with the REST gateway with Set-Cookie: headers.

The REST gateway code creates an HTTP session when it receives a request from a client that is not currently in session. To prevent unnecessary creation of sessions and to get peak performance, the REST client must remember cookies that are returned from the REST gateway with Set-Cookie: headers and supply those same cookies back to the REST gateway with Cookie: headers on subsequent requests.