We are now aware of what our user is interested in. It would be a good idea to improve our Tweet controller so that it allows searching from a list of keywords.
One interesting way to pass key-value pairs in a URL is to use a matrix variable. It is pretty similar to request parameters. Consider the following code:
someUrl/param?var1=value1&var2=value2
Instead of the preceding parameter, matrix variables understand this:
someUrl/param;var1=value1;var2=value2
They also allow each parameter to be a list:
someUrl/param;var1=value1,value2;var2=value3,value4
A matrix variable can be mapped to different object types inside a controller:
Map<String, List<?>>
: This handles multiple variables and multiple valuesMap<String, ?>
: This handles a case in which each variable has only one valueList<?>
: This is used if we are interested in a single variable whose name can be configured
In our case, we want to handle something like this:
http://localhost...