From: <pn...@hy...> - 2010-04-15 04:13:11
|
Author: pnguyen Date: 2010-04-14 21:13:02 -0700 (Wed, 14 Apr 2010) New Revision: 14506 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14506 Modified: trunk/plugins/netservices/src/org/hyperic/hq/plugin/netservices/HTTPCollector.java Log: [HHQ-3446] Allow the HQ agent's HTTP user agent to be overridden by a system property ("httpclient.useragent") Modified: trunk/plugins/netservices/src/org/hyperic/hq/plugin/netservices/HTTPCollector.java =================================================================== --- trunk/plugins/netservices/src/org/hyperic/hq/plugin/netservices/HTTPCollector.java 2010-04-14 21:40:30 UTC (rev 14505) +++ trunk/plugins/netservices/src/org/hyperic/hq/plugin/netservices/HTTPCollector.java 2010-04-15 04:13:02 UTC (rev 14506) @@ -55,6 +55,7 @@ private String url; private String method; private String hosthdr; + private String useragent; private Pattern pattern; private ArrayList matches = new ArrayList(); private String proxyHost = null; @@ -87,6 +88,10 @@ this.url = protocol + "://" + getHostname() + ":" + getPort() + getPath(); + this.useragent = + System.getProperty("httpclient.useragent", + "Hyperic-HQ-Agent/" + ProductProperties.getVersion()); + //for log_track setSource(this.url); @@ -257,8 +262,7 @@ getMethod().equals(METHOD_HEAD); HttpClient client = new HttpClient(); HttpClientParams params = new HttpClientParams(); - String userAgent = "Hyperic-HQ-Agent/" + ProductProperties.getVersion(); - params.setParameter(HttpMethodParams.USER_AGENT, userAgent); + params.setParameter(HttpMethodParams.USER_AGENT, this.useragent); if (this.hosthdr != null) { params.setVirtualHost(this.hosthdr); } |