I have the following method:
@Path("/criar_evento")
@GET
@Consumes({"application/json", "application/xml"})
@Produces({"application/json", "application/xml"})
public synchronized Evento addEvento(@QueryParam("nome") String nome, @QueryParam("data") String data, @QueryParam("tipo") String tipo) {
Evento evento = new Evento(nome,data,tipo);
System.out.println(nome + "\n" + data + "\n" + tipo);
return evento;
}
When I try to run this terminal code:
curl http://localhost:8001/sd/evento/criar_evento?nome=teste&data=25082001&tipo=basket
I get the data and tipo as null values but not the name
Here is the output on the server:
teste
null
null
But if I try for example:
curl http://localhost:8001/sd/evento/criar_evento?data=25082001&tipo=basket&nome=teste
In the server I get:
null
25082001
null
Any ideas in how to fix this?
@Consumes. TheGETmethod handles only key-value pairs in the URL, and@Consumesmay be confusing the code (@Confuses?)&may be being interpreted by your shell. Try enclsing your URL in'characters.