Method method = HttpMethodBase.class.getMethod("getResponseContentLength", new Class[0]); if (method.isAccessible()) { _httpClientHelper = new HttpClientHelper3x(); Message.verbose("using commons httpclient 3.x helper"); } else { _httpClientHelper = new HttpClientHelper2x(); Message.verbose("using commons httpclient 2.x helper"); }
HttpMethodBase.class.getMethod("getResponseContentLength", new Class[0]); _httpClientHelper = new HttpClientHelper3x(); Message.verbose("using commons httpclient 3.x helper");
    private HttpClientHelper getHttpClientHelper() {        if (_httpClientHelper == null) {            // use commons httpclient 3.0 if available            try {                Method method = HttpMethodBase.class.getMethod("getResponseContentLength", new Class[0]);                if (method.isAccessible()) {                    _httpClientHelper = new HttpClientHelper3x();                    Message.verbose("using commons httpclient 3.x helper");                } else {                    _httpClientHelper = new HttpClientHelper2x();                    Message.verbose("using commons httpclient 2.x helper");                                    }            } catch (SecurityException e) {                Message.verbose("unable to get access to getResponseContentLength of commons-httpclient HeadMethod. Please use commons-httpclient 3.0 or use ivy with sufficient security permissions.");                Message.verbose("exception: "+e.getMessage());                _httpClientHelper = new HttpClientHelper2x();                Message.verbose("using commons httpclient 2.x helper");            } catch (NoSuchMethodException e) {                _httpClientHelper = new HttpClientHelper2x();                Message.verbose("using commons httpclient 2.x helper");            }        }        return _httpClientHelper;    }