web: Implement a basic REST JSON client

Here's a basic REST JSON client that uses 'text-stream' channels.
It only supports GET requests so far.

We introduce a new namespace for Cockpit called $cockpit. This allows
us to start organizing our code into such a namespace, and getting
ready for foreign code in the same javascript context.

We use jQuery Deferreds as the model for async processing, as this
provides a reliable mechanism for connecting handlers, reporting
failures, progress, etc..

See rest.js near the top for documentation on how to use the REST
JSON client.

Fixes #258
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Add POST support to REST client

Added $cockpit.rest(xxx).post(yyy) method to rest.js and tests
This sends the params as application/json.

If query string params are desired, these can be included on the
@path argument.

Fixes #259
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Implement REST DELETE method

And add some tests for it. 'delete' is a reserved word in javascript
so the method is called .del()

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Add support for REST streaming of responses

This is where the response contains mulitple JSON snippets and
we want to see them as they get pushed from the server.

This is Docker style as in /events in their API.

Strictly speaking this could break if a channel message ending
does not line up with the end of the JSON. However for the time
being this should work.

Also add some tests of receiving data split into multiple
channel messages.

Fixes #254
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
web: Define a new RestError class and expose HTTP errors correctly

REST uses specific errors for specific conditions, so expose them
for callers to access.

In addition we map some errors to our Cockpit style string problem
codes.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>