'How to translate curl call to RestEasy Call?

This is a curl call I found:

curl --location --request POST 'https://whatever.com/adfs/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'scope=allatclaims' \

Now I need to use it in Java Resteasy. But what I did seems to be wrong:

@POST
@Path("/adfs/oauth2/token")
@Produces({"application/json"})
String getJwt(
        @HeaderParam("Content-Type") String contentType,
        @QueryParam("grant_type") String grantType,
        @QueryParam("scope") String scope);

How to translate --data-urlencode . Do I have to Url-encode it ? Is it right what i do when I assume it is a @QueryParam ? Thanks for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source