Clearer demarcation between the service layer and the view layer is much needed. Client side services need to live on the view layer. I know we are trying to be more opinionated about the EMR and distros, but that can be achieved through generic services that allow clients to use those services to store their settings, instead of us building client-side services on the server-side.
To answer this specific question, I feel that instead of creating our custom views (RAW, URL, HTML etc.), we should use HTTP headers, for representations. For the RESTWS module this is nicely done through the Accept header, but for only two types (application/json and application/xml) is really supported. An HTML view will be nice to have and probably good for documentation, but is another story. If the client asked for JSON, they are explicitly expecting (generally speaking UTF-8 encoded, unless specified) characters that is a valid JSON. Like Lluis said, and many people do, binary content can be GET as Base64 string, but with its corresponding correct mimeType. For a POST, the value field with its Base64 string is fine, but we also need to deal with its mimetype.
I feel Base64 encoding on the client side is troublesome and particularly that we want to support low-resource settings. I suggest that the "value" field of the obs resource should be a URL pointing to a /complexobs/{uuid} resource that supports GET binary/text data and POST with Content-Type: multipart/form-data and Content-disposition. In our
ComplexObsServlet, we assume a .jpg type which is not correct. The way many other projects/web servers are doing this is using the
Apache Tika project. I recommend that we use Apache Tika for content detection and not have the user set mimeType at all.
Burke, why is Handler a server-side consideration? Probably a client-side thing for our web application. Is it because you expect that multiple images (in a complex obs) can be converted into a video and that view can be requested? Can you give some use-cases where supportedViews is a server-side problem to be solved.