I'm in doubt as to how to implement the DELETE method of the HTTP web service REST JAVA protocol, when I run it says I'm running the GET method and not DELETE.
// Method Called in Web Service
public void remove(Promocao promocao) {
id_conexao = N.Conectar();
String sql = "delete from promocao where idpromocao=?";
try {
stmt = id_conexao.prepareStatement(sql);
stmt.setInt(1, promocao.getIdpromocao());
//executa
stmt.execute();
System.out.println("Promocao Excluida");
} catch (SQLException e) {
System.err.println("ERRO ao excluir promoção - " + e);
} finally {
N.Desconectar();
}
}
// DELETE in Java Web Service
@DELETE
@Path("excluirPromocao")
public void excluir(String content){
Gson g = new Gson();
Promocao P = (Promocao) g.fromJson(content, Promocao.class);
PromocaoOp promo = new PromocaoOp();
promo.remove(P);
}