You have several options.
Option 1: query parameter with multiple values
You can provide several simple values ββfor one query parameter. For example, a query string might look like this:
PUT /path/to/my/resource?param1=value1¶m1=value2¶m1=value3
Here, the param1 query parameter has three values, and the container will give you access to all three values ββas an array (see Query String Line ).
Option 2: provide complex data in a PUT package
If you need to send complex data to a PUT request, this is usually done by delivering this content to the request body. Of course, this payload can be xml (and linked via JAXB).
Remember that the point of the URI is the identification of the resource ( RFC 3986, 3.4 ), and if this array of values ββis the data that is needed to identify the resource, then the URI is a good place to do this. If, on the other hand, this data array is part of a new view that is sent in this PUT request, then it belongs to the request body.
Having said that, if you really do not need an array of simple values, I would recommend choosing option 2. I can not come up with a good reason to use URL-encoded XML in the URL, d be interested to know more about what exactly this data is.
joelittlejohn
source share