I'm creating a endpoint (using Jersey annotations) that receives a list of Strings as it's parameter. The strings need to contain a key and a value. So on the url it would look something like
?params=key1=value1¶ms=key2=value2¶ms....
Two questions:
- I'm not sure if the above example would work, I assume you would have to encode the = sign between key and value. Is that correct?
- Is there a better or more standard way to approach this?
Obviously the most standard way would be to have the RHS be the key and the LHS of the equal sign would be the value. The problem is I don't want to define every possible key value pair in my method signature. I want to accept a general list of keys and values and let the user pass in the pairs that are relevant to their query.
So far I've tried several google queries but haven't found an answer:
- java url key and value parameter
- java url parameters with key and value
- list of key value pairs in url java
- Storing a list of key value pairs in a url parameter, javascript. (has an answer for php but I'm using Java, would this work in Java?)
- how to send an array in url request (suggests the above would work in java, if so, can the index be a string like ¶ms[key2]=value2...?)