users@jersey.java.net

Re: [Jersey] Jersey Client WebResource delete with request entity?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 11 Dec 2009 16:01:31 +0100

On Dec 11, 2009, at 2:01 PM, Paul Sandoz wrote:

> Hi Rick,
>
> The problem is HttpURLConnection does not support the sending of
> request entities for a DELETE request, and Jersey is masking that
> error as a consequence of attempting to recover. So i need to fix
> that error reporting. Could you log an issue?
>

No need to log an issue. I have fixed things in the trunk so that the
original exception is thrown and you should see a stack trace like the
following:

java.net.ProtocolException: HTTP method DELETE doesn't support output
com.sun.jersey.api.client.ClientHandlerException:
java.net.ProtocolException: HTTP method DELETE doesn't support output
         at
com
.sun
.jersey
.client
.urlconnection
.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:128)
         at com.sun.jersey.api.client.Client.handle(Client.java:457)
         at
com.sun.jersey.api.client.WebResource.handle(WebResource.java:557)
         at
com.sun.jersey.api.client.WebResource.delete(WebResource.java:251)
         at com.sun.jersey.impl.container.grizzly.web.HttpMethodTest.testDelete
(HttpMethodTest.java:113)
Caused by: java.net.ProtocolException: HTTP method DELETE doesn't
support output
         at
sun
.net
.www
.protocol
.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:873)
         at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler
$1$1.getOutputStream(URLConnectionClientHandler.java:200)
         at
com
.sun
.jersey
.api
.client.CommittingOutputStream.commitWrite(CommittingOutputStream.java:
114)
         at
com
.sun
.jersey
.api.client.CommittingOutputStream.write(CommittingOutputStream.java:86)

Paul.