my interface looks as follows:
@Rest(rootUrl = "https://myurl.com", converters = { GsonHttpMessageConverter.class })
public interface CommunicatonInterface
{
@Get("/tables/login")
public Login login(Param param);
public RestTemplate getRestTemplate();
}
The question is what i supposed to put as a param to get in body simply:
login=myName&password=myPassword&key=othereKey
without escaping, brackets or quota.
I've try to pass a string and i just get:
"login=myName&password=myPassword&key=othereKey"
but it is wrong because of quota signs.
If I understand correctly, you want to post login
and password
parameters from a form to your method.
For this, you should ensure you have the following steps:
login
and password
as names.form
has a POST
method, you don't really want to have user's credentials in the URL as get params, but if you use case needs you to do it, you can.Interface
, instead of using GsonHttpMessageConverter
you should be using FormHttpMessageConverter
. This converter accepts and returns content with application/x-www-form-urlencoded
which is the correct content-type
for form submissions.Param
class should have fields which have the same name as the input text fields. In your case, login
and password
. After you do this, request parameters posted in the form will be available in the param
instance.Hope this helps.