Hi Steve, > Is there a way to do a POST with an "Expect:" header in Restlet? > To use Expect you construct your POST except you leave off the > body and stick in an "Expect: 100-continue". If the server is > happy to receive your POST he returns status 100 and the client > sends the normal POST with content. This can be used to prevent > trying to send huge amounts of data over the network if the server > can't really handle it.
Thanks for exposing this interesting use case. There is no support for this HTTP feature in the Restlet API. I've entered a RFE to add support for this: http://restlet.tigris.org/issues/show_bug.cgi?id=413 > But I can't find a way to construct a POST where I can set the Content-Length > header myself. It seems to only calculate it based on the size of the body, > which defeats the point of the "Expect" header. With the Restlet API, you generally work with a higher-level API, with objects and properties instead of raw headers. I think that the "Expect/Continue" feature should be internally handled by the HTTP client and server connectors instead of the developer. The developer should only be able to indicates that he prefers to get a confirmation from the server before sending the message body. This could be defined using a "Request.clientInfo.expectsContinue" Boolean property. > (As a side note, I first was tinkering with this using the Apache > client and it was eating the Expect header somewhere along the way. > Switching to the Net client let the Expect header go through [with > a complaint from Restlet] and then I ran into the problem described >above.) I don't think you'll be able to workaround this issue unless your patch the Restlet engine and HTTP connector classes. Best regards, Jerome

