开发者

How to check if PUT can be performed before sending request body?

Note: we are using lib_neon on client side and Tomcat and servlet api on server side.

The problem is following: when client wants to put some content, it performs a PUT request with an "Expect: 开发者_StackOverflow社区100-continue" header, Tomcat handles it by simply returning status 100 Continue and after that client starts to send the remaining part of request, and it gets processed by our custom Filters and often it doesn't pass (for instance user is not authorized, or tries to put too large file, exceeding users limit, or something else). Filter sends an error response immidetetly, but client reads the response only when the full request body is commited.

It seems that it is impossible to manually send something instead of 100 Continue status, when some check fails, and this behavior is hardcoded into tomcat, is there any other way not to upload request body, when it is impossible?


You need a servlet container with a more sane 100-continue handling (I believe jetty qualifies).

I can't believe this clarification still isn't part of the servlet spec; I believe I asked for it something like 7 years ago.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜