ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Le" <Al...@gmx.de>
Subject Re: How to capture HTTP response with the status 500?
Date Tue, 17 Jan 2017 12:05:03 GMT
Hello Klaus,

> I am quite confident that you can call the 
> Method HttpURLConnection.getErrorStream within the respective catch block to 
> read the body of the HTTP response. Hope that helps.

Thank you for the tip! I didn't know of that method!

Indeed, with getErrorStream() I could read out the response (had to downcast to HttpURLConnection
first of course).

IMO it would be a very useful enhancement to the Get task if one could

1. Specify the property to write the response code (status code) to

2. Specify the file to write the error response to (or if the task just wrote it to the file
specified by 'dest'). If 'ignoreerrors' is set to false, the build should fail as usual.

With these two enhancements, the script could set 'ignoreerrors' to 'true' and then analyze
what happened and proceed as it fits.

AL

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message