I'm making a REST Web Service with java and spring framework. I need to make the service as well the consumer.
I am running into a problem regarding the way I can receive a string through the querystring use by the request link.
This "string" attribute would be sort like of a quote e.g "insert your quote".
My idea was receiving it as a @RequestParam in my program passed by the querystring i.e //server/path/program?text="Insertyourquote"
As one can see, I would have a deal of a problem to know where to split these words(if there's a comma, a question mark, etc) in my method mapped to attend that request. You see, how do I know where has a word started and end if they are all together?
I need every single word of the sentence in my method.
My question is:
To get this parameter I will need to:
1- Make other Web Service expose a JSON with an object that contains this "quote" attribute and use my Web Service to reach it and get it or...
2- There is a way of using the querystring to pass the "quote" without taking out the blank spaces i.e //server/path/program?text="Insert your quote" or... (this is the last one, I promise)
3- Do some kind of customization on the "quote" that is about to be sent, like:
//server/path/program?text="Insert%your%quote" - So, where is the "%" I know that is a blank and then, I know where I should split to get the single word or... (I lied)
4 - None of the above. In this case, please, leave me an alternative.
That's All, Thanks.
P.S: It is my first post so any complaint or tip is very welcome and, if still needed something more "concrete" to work with, I can provide more sources.
UPDATE
When to use @QueryParam vs @PathParam
My question is not just about "best practices" or convention but, rather, how can I pass the above quote in a request to use it later in a mapped method.
In other words, regardless of using @QueryParam or @PathParam, the point here is to get a way of passing the quote in a single request or by other option.