o produto esta lá mas da erro 404 $ curl -v http://localhost:8080/carrinhos/1 timeout on name lookup is not supported Trying ::1... TCP_NODELAY set % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 Trying 127.0.0.1... TCP_NODELAY set Connected to localhost (127.0.0.1) port 8080 (#0)
GET /carrinhos/1 HTTP/1.1 Host: localhost:8080 User-Agent: curl/7.54.0 Accept: /
< HTTP/1.1 200 OK < Content-Type: application/xml < Date: Wed, 08 Nov 2017 10:12:21 GMT < Content-Length: 568 < { [568 bytes data] 100 568 100 568 0 0 1010 0 --:--:-- --:--:-- --:--:-- 1040 4000.0 6237 Videogame 4 1 60.0 3467 Jogo de esporte 2 Rua Vergueiro 3185, 8 andar S‹o Paulo 1 * Connection #0 to host localhost left intact
Quando tento remover:
$ curl -v -X DELETE http://localhost:8080/carrinhos/1/produtos/6237 timeout on name lookup is not supported Trying ::1... TCP_NODELAY set % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 Trying 127.0.0.1... TCP_NODELAY set Connected to localhost (127.0.0.1) port 8080 (#0)
DELETE /carrinhos/1/produtos/6237 HTTP/1.1 Host: localhost:8080 User-Agent: curl/7.54.0 Accept: /
< HTTP/1.1 404 Not Found < Date: Wed, 08 Nov 2017 10:13:52 GMT < Content-Length: 0 < 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 * Connection #0 to host localhost left intact
Segue o código: @Path("{id}/produtos/{produtoId}") @DELETE public Response removeProduto(@PathParam("id") long id, @PathParam("produtoId") long produtoId) { Carrinho carrinho = new CarrinhoDAO().busca(id); carrinho.remove(produtoId); return Response.ok().build(); }