1.6. Termination of the request
In some cases, the HTTP request will fail within the expected time due to a high load on the target server or a large number of simultaneous requests from the client. At this point, it is necessary to prematurely abort the request and unlock the lock in I/O execution. When HttpClient executes, the request can be aborted at any stage by calling the Httpurirequest#abort () method. This method is thread-safe and can be called from any thread. When an HTTP request is aborted, its execution thread--is blocked in the I/O operation--and guaranteed to be unlocked by throwing a interruptedioexception exception.
1.7. REDIRECT Processing
HttpClient automatically handles all types of redirects. Except those that are expressly forbidden by the HTTP specification, such as the need for
of the user intervention. Refer to the redirection of other (status Code 303) POST and PUT requests to get requests that meet the HTTP specification requirements. You can use a redirect policy to break the limit for automatic redirection of post methods (post auto redirection is imposed for HTTP specification).
During the execution of the request message, httpclient often needs to rewrite it. Each default http/1.0 and http/1.1 use a relative URI. Similarly, the original request needs to be redirected from one address to another multiple times. The final absolute HTTP address will be built by the original request and context. The function method Uriutils#resolve is used to construct the absolute URI that the final request forms. This method contains the previous identity from the redirect and the original request.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced! If you want to reprint please declare: "Transfer from http://blog.csdn.net/u011179993"
"HttpClient4.5 Chinese Course" "Chapter I: Basics" 1.6 Termination request, 1.7 redirect Processing