xquery/rxq — pull request #23 by cfoster (2014-09-09 15:05:51+00:00)
Title: gzip moved to %xdmp:gzip annotation.

In this pull request, gzip compression is no longer a global flag but can be turned on at the function level by adding the `%xdmp:gzip` annotation. I hope this is OK?

Not all HTTP clients support gzip compression - in-fact, MarkLogic's HTTP client breaks when the response is gzipped UTF-8. Also, gzip is only useful on larger content, so in my opinion I think it would be better to allow the user to choose where and when content should be gzipped.

This pull request also doesn't take into consideration clients **NOT** sending "Accept-Encoding: gzip", but it's a step in the right direction.

Also, the filter section of RXQ should now be cleaner and further filters/annotations can be added with ease.

The following code snippet shows the `%xdmp:gzip` annotation in action.

```xquery
declare
%rxq:produces('text/plain')
%output:method('text')
%rxq:GET
%xdmp:gzip
%rxq:path('/text-content-gzipped')
function text-content-gzipped(){
text { "Hello World, gzipped" }
};
```