I am trying to create a record in a Mysql BD. In the client I use the new API Rest but it sends me the following error when I include a Param method with Body:
"[EDT] 0: 0: 0.2 - Exception: java.lang.IllegalStateException - Request body and arguments are mutually exclusive, you can't use both"
On the server I use Spring Boot and I accept the 2 conditions (at least it doesn't send compilation error).
Any idea how to do it correctly?
My client code:
public static Response addMarcacion(Marcacion m) {
Response<String> r = Rest.post(SERVER_URL + "marcacion/adicionCambio").
jsonContent().
queryParam("token", UsuarioService.getToken()).
body(m.getPropertyIndex().toJSON()).getAsString();
return r;
}
@RequestMapping(method = RequestMethod.POST,value = "/adicionCambio")
public @ResponseBody String addMarcacion(
@RequestParam(name="token", required = true) String token,
@RequestBody MarcacionDAO mDAO) throws IOException, ParseException {
if(mDAO.getMarcacionID() != null) {
marcaciones.updateMarcacion(token, mDAO);
return mDAO.getMarcacionID().toString();
} else {
return marcaciones.addMarcacion(token, mDAO);
}
}