Http Server: Support stringstream for multi-part body

Http request with multi-part body can be used to transfer form
parameters. In those cases, using a strningstream is more adequate than
a file.

This patch adds a default behavior to the multi part parser that would
store the information in a stringstream object. The original behavior
of using a temporary file remain, if the handler define such a file.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Http Server: Move the json_exception wrapper to exception.hh

json_exception is a wrapper class that translate an exception to a json
format response. It is no required outside of routes.cc so it would move
to exception.hh

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Http Server: Return a json object when no handler is found

All the API request return json object.

This change return a json object with a 404 error code even if no
handler is found at all.
It also return a json object with 404 and page not found when a file is
not found.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Http Server: expose the url parsing method

This patch expose the url static parsing method outside of the class. It
would be used by the new batch API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Swagger Definition: Add an API for batch processing

This adds a definition for a batch api. The batch request content is
passed in the request body.

The reply is a list of objects. Swagger does not support any-object to
be defined, so the return type is set to string.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Http Serve: Add a batch api implementation

This patch adds a batch API support.

It gets the definitions from the message body as a list of json objects
and uses a parser to create a request out of each of objects.

The handler uses the routes object to perform the request. The result
are combined in a list of objects.

If the parser is unable to parse the request, it would fail before any
of the request is attempted.

To test the changes do:

curl -F 'batch=[{"method":"GET",
"relative_url":"/os/version"},{"method":"GET",
"relative_url":"/os/name"}]' http://localhost:8000/api/batch

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>