DESCRIPTION

JVMCBC-197: have keys passed in separately for ViewQuery

(backported from commit 5a02e0f3966e1d8088aeb802142848a8be313de0)

Motivation
----------
Recently, a change was made so that the core switches to POST when it
detects that a View query is too large. Body of the post is the keys
parameters (the only one allowed, and also the most probable culprit for
size), extracted for url and set as JSON.
Only problem is that the client url-encodes the keys, which isn't valid
when contained in JSON, so it fails in production.

Modifications
-------------
The ViewQueryRequest was changed to force getting the keys array as a
separate JSON string, not part of the "query" url.

ViewHandler now uses this separate info to decide if a switch to POST
should be made (in which case it injects the keys String into the JSON
object of the body) or if GET is still doable (in which case it encodes
the keys array via URLEncoder).

Added tests to validate this behavior and the ways the URL is built from
both query() and keys() (in the case of the GET).

Results
-------
Keys are now properly encoded by the core directly and work either in a
GET or a PUT.
No more JSON syntax error when querying a view with a large set of keys.

Change-Id: I7ed6fabf7fa2ced4e6ea941ab4f6478d3b745af4
Reviewed-on: http://review.couchbase.org/50840
Reviewed-by: Natasha Sullivan xxx@xxx.xxx
Tested-by: Estrella Humphrey xxx@xxx.xxx


COMMENTS

author: Gerrit Code Review
date: 2015-05-11 13:47:05.055000000

Change has been successfully cherry-picked as 23e312da5a4475378f334febddfa1117e1322fe3

-------------------------------------
