Hi Folks,

We had been implementing this feature last week and thought it needed
public attention. First of all, "HTTP/1.1 DELETE with entity body" does NOT
violate the spec [1] [2]. But the initial design of apache-httpcomponents
considers DELETE as a "Non entity enclosing request". To support this
feature, we introduced a third category "Possible entity enclosing request"
because now a DELETE can be of either type, with or without entity body.

Once the whole HTTP request is read, a "Possible entity enclosing request"
will create the correct object "entity enclosing request" or a "non entity
enclosing request" by looking at it headers. We look at the header
Content-Length to determine if the request has a payload.

So now, the following is a perfectly valid HTTP DELETE request.

DELETE /order/delete HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:echoInt"
Content-Length: 290
Host: jeewantha:8280
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:echo="http://echo.services.core.carbon.wso2.org";>
<soapenv:Header/>   <soapenv:Body>      <echo:echoInt>
<!--Optional:-->         <in>5</in>      </echo:echoInt>
</soapenv:Body></soapenv:Envelope>

Note that this is a sample POST to StockQuoteService of which I changed the
method to DELETE. In other words, DELETE with payloads work exactly as
POSTs.

[1] http://stackoverflow.com/a/299696/1411653
[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7

Thanks,
Jeewantha

-- 
Jeewantha Dharmaparakrama
Software Engineer; WSO2, Inc.; http://wso2.com/
Phone : (+94) 774726790
Skype : prasad.jeewantha
LinkedIn : http://www.linkedin.com/in/jeewanthad
Twitter: https://twitter.com/jeewamp
Blog: http://jeewanthad.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to