You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2015/02/12 17:43:04 UTC

[OT] Java client using Expect: 100-continue

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

I've been trying to find some information online about how to do this,
and maybe I'm just being bad search terms.

I've not yet played-around with any code for this, but I'm interested
in observing the server's response to an Expect: 100-continue header
when a request has a body (e.g. PUT, POST, etc.).

This is from an HTTP client's perspective, and I've got code that
already uses HttpURLConnection to open a connection and stream a body
if requested. Before streaming the body, I'd like my code to take a
look at the server's response and maybe make some decision based upon
that. For instance, if the server replies with "417 Expectation
Failed" then I'd like to maybe throw some kind of exception, or maybe
.. I dunno, compress the request to see if the body is small enough to
re-try.

Anyhow, I don't see anything in the API that directly supports this,
and I haven't found anything online about how to do this in
HttpURLConnection other than the obvious setting of the HTTP header.
Is this something that HttpURLConnection does not expose to the
programmer? Does it simply handle the situation on its own?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU3NgYAAoJEBzwKT+lPKRYpnQP/13Y6lIyahy8Dfq7g1u72OXL
KJ9Ys0XoBxvwiIQ7LLqZvKpmrKll5hD1dQd4bTwQfshDqOsQITjIKtdY8Y29M9tP
hpZ8WCkjmjcYVAIPH1Kj2M54cOJukyXJi6LNgz4QPY82LA/T9Us/ltYe/GxmUWol
7dfkSZuai5h+LBj3Yxn3Fk5A8YLnpG0OHf/qrlt3KqWddk/47oOEzKwiaPfJx6qL
NURiBTTlhfveXiVa4EJ0zitZjamvTlxpq0t7VAW5QZFbalOZDVSCFEBS7bRwBsUv
lqGXOxY4U0q+M5vjwTuO6IhKm6HfYJe6hEI5Gy5PdanZR15UmWcidftybe0SQwNi
fYlV3FPrja6Qv/JNb72b4F79Vgl2cNselar3Q9LQ66mTEtJCL+t6teGH1Vi6rax6
O28nwUjZq40CuwDr/DyztIRDnuhc48z4hz23YyjUhfh0y4qMhaeO4DCvX9EQLOvF
8qerVT8js+zd62J8ie/Grg7jFjO1rbtcmrNONiet7GA3Hko9Fl40vTu3OjAJYxjX
cicCZQwkCd2Mc3sLfqfxpgFpOlJYyyThB+guttvvjE1R2ivm8O23DNX8UKbK1lXE
ja/N0y5gC3QpbFkg//wekukA/sz/AZ5T97KeCZ9Dilljx02yDr83VflDXXAnF6Lj
IifLIFgdyWHSqSCEWa27
=Ovez
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] Java client using Expect: 100-continue

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Konstantin,

On 2/12/15 11:52 AM, Konstantin Kolinko wrote:
> 2015-02-12 19:43 GMT+03:00 Christopher Schultz
> <ch...@christopherschultz.net>:
>> 
>> All,
>> 
>> I've been trying to find some information online about how to do
>> this, and maybe I'm just being bad search terms.
>> 
>> I've not yet played-around with any code for this, but I'm
>> interested in observing the server's response to an Expect:
>> 100-continue header when a request has a body (e.g. PUT, POST,
>> etc.).
>> 
>> This is from an HTTP client's perspective, and I've got code
>> that already uses HttpURLConnection to open a connection and
>> stream a body if requested. Before streaming the body, I'd like
>> my code to take a look at the server's response and maybe make
>> some decision based upon that. For instance, if the server
>> replies with "417 Expectation Failed" then I'd like to maybe
>> throw some kind of exception, or maybe .. I dunno, compress the
>> request to see if the body is small enough to re-try.
>> 
>> Anyhow, I don't see anything in the API that directly supports
>> this, and I haven't found anything online about how to do this
>> in HttpURLConnection other than the obvious setting of the HTTP
>> header. Is this something that HttpURLConnection does not expose
>> to the programmer? Does it simply handle the situation on its
>> own?
>> 
> 
> See the following recent BZ issue for a link 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=57530

Thanks. From my reading of that, the answer is "you can't do what you
want to do". I'll play around with what happens with 417.

I'm almost certainly not going to abandon HttpURLConnection and deal
with the socket directly. :)

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU3gN/AAoJEBzwKT+lPKRY0pQP/jGYycc/jNu6z2Tk5CReBv3T
7IOT0QtRmTx8/6O3hjCXbGCXTYPTaDZTKW4uP4r/BGvvzJpRsXj7KwzlVWxEeSw3
OEJyinCstCL1tcOrN0Rvc5CH/2X/k8iLVEp/7YSrC0k8pvm3mNU/mzqilN54Z2vY
Fq3SBZUqxhRkUXyq1VPsWA1EZcUnH378E1E+FJi0znPExCH+wSRXYvMCMIwOEaEw
OAB7Xf5ocBxPWGg6AEuCspQh1Xp4oUxct2O9EslmQwxA++nT8ypVj2QL7krcZIeI
oR9z3vPJVWbxHNL2V4B6rvEjdv6BlNoI72Ym6Xt1A8Ss0nqdkqB/VipiYXBIxmOe
uy++MzCegq+eleHGDlWLtV7nIq2OgGnP8P0fdIpq8qY5hIul6RlbURr1EtwZSzcj
7mHhFU2h1WEgw8PzIVu/dATwXiPoQQAU5tasZnwyny1hIWuN46jRTsvvHtemICsM
OxepL0JttfgDYN9KLBuwZySZm4O9OW2MxC0qoGXdv4v8g/9qJYLmQoi2aa9CeuuL
xYfqtAiZbOs8Pl+M5ffbNFWL3E4WrOTjR9OlFr51hj4Q5b9nnzZNi+p2uioPhfgE
GdbwEOQqkubOFOVAq9ilvjMY5T9UQmabyYQeSYGI3o6e1AAusiOKG/96PQifTp9M
qRAu1f5vdFWuqjhuwUdH
=MRJR
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] Java client using Expect: 100-continue

Posted by Konstantin Kolinko <kn...@gmail.com>.
2015-02-12 19:43 GMT+03:00 Christopher Schultz <ch...@christopherschultz.net>:
>
> All,
>
> I've been trying to find some information online about how to do this,
> and maybe I'm just being bad search terms.
>
> I've not yet played-around with any code for this, but I'm interested
> in observing the server's response to an Expect: 100-continue header
> when a request has a body (e.g. PUT, POST, etc.).
>
> This is from an HTTP client's perspective, and I've got code that
> already uses HttpURLConnection to open a connection and stream a body
> if requested. Before streaming the body, I'd like my code to take a
> look at the server's response and maybe make some decision based upon
> that. For instance, if the server replies with "417 Expectation
> Failed" then I'd like to maybe throw some kind of exception, or maybe
> .. I dunno, compress the request to see if the body is small enough to
> re-try.
>
> Anyhow, I don't see anything in the API that directly supports this,
> and I haven't found anything online about how to do this in
> HttpURLConnection other than the obvious setting of the HTTP header.
> Is this something that HttpURLConnection does not expose to the
> programmer? Does it simply handle the situation on its own?
>

See the following recent BZ issue for a link
https://issues.apache.org/bugzilla/show_bug.cgi?id=57530


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org