I am using CXF Jax-rs, wanted to pass 2 JSON objects as arguments to my rest service method.
I was able to pass one object as argument.
Appreciate any help.
thanks,
Bob
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume by passing a “JSON object” (not the best terminology but I think I know what is meant here) you mean you are passing a parameter to a service method via an entity body, and specifying its content type.
As you know in JAX-RS only one parameter can be bare (that is, not marked with
@PathParamor@QueryParamor@MatrixParametc.) and that single unannotated parameter comes from the entity body.So you cannot pass two such parameters. It is not allowed.
What you can do is encode your entity body of the request in JSON as follows:
which fakes two “objects” into one.