+\r
+\r
+ /**\r
+ * Requests the received method with the received timeout (milliseconds).\r
+ * \r
+ * Executes the method through the inherited HttpClient.executedMethod(method).\r
+ * \r
+ * Sets the socket timeout for the HttpMethodBase method received.\r
+ * \r
+ * @param method HTTP method request.\r
+ * @param timeout Timeout to set, in milliseconds; <= 0 means infinite.\r
+ */\r
+ public int executeMethod(HttpMethodBase method, int readTimeout) throws HttpException, IOException {\r
+ int oldSoTimeout = getParams().getSoTimeout();\r
+ try {\r
+ if (readTimeout < 0) { \r
+ readTimeout = 0;\r
+ }\r
+ HttpMethodParams params = method.getParams();\r
+ params.setSoTimeout(readTimeout); \r
+ method.setParams(params); // this should be enough...\r
+ getParams().setSoTimeout(readTimeout); // ... but this is necessary for HTTPS\r
+ return executeMethod(method);\r
+ } finally {\r
+ getParams().setSoTimeout(oldSoTimeout);\r
+ }\r
+ }\r