Is it possible to parse the string keys from a request such as this, with the Java servlet API?
http://localhost:8080/?assocArray[key1]=value1&assocArray[key2]=value2&assocArray[key3]=value3
getParameterValues("assocArray") returns ["value3","value1","value1"]
The ordering of the values in the returned array is not order of the keys (not that it matters)
SOLVED: It is possible, the keys are interpreted as simple global key strings. Java doesn’t recognize them as an array. Use regex
Not directly. The
[]have no special meaning in HTTP request parameters and are by the Servlet API not recognized as array keys (you was perhaps a PHP programmer which indeed has a proprietary parser for this?). You need to parse and collect it yourself in a loop.For example,