aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorMartin Stockhammer <m.stockhammer@web.de>2016-09-13 16:46:50 +0200
committerMartin Stockhammer <m.stockhammer@web.de>2016-09-13 16:46:50 +0200
commitbd10f7b8a2ff638bb4b3796321425cac9db5476a (patch)
tree09dcbea9560686d9f75b6b55eec785d997da3f9c /archiva-modules
parentcae55ace9ff82bf55aec318e237ba9768ccc940f (diff)
downloadarchiva-bd10f7b8a2ff638bb4b3796321425cac9db5476a.tar.gz
archiva-bd10f7b8a2ff638bb4b3796321425cac9db5476a.zip
Adding default userAgent system property
The default userAgent string used for proxy connections can be configured by a system property.
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java
index 0e297f508..40544022d 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java
@@ -29,6 +29,11 @@ import java.util.Map;
*/
public class WagonFactoryRequest
{
+
+ public static final String USER_AGENT_SYSTEM_PROPERTY = "archiva.userAgent";
+
+ private static String DEFAULT_USER_AGENT = "Java-Archiva";
+
/**
* the protocol to find the Wagon for, which must be prefixed with <code>wagon#</code>, for example
* <code>wagon#http</code>. <b>to have a wagon supporting ntlm add -ntlm</b>
@@ -37,7 +42,13 @@ public class WagonFactoryRequest
private Map<String, String> headers = new HashMap<>();
- private String userAgent = "Java-Archiva";
+ private String userAgent = DEFAULT_USER_AGENT;
+
+ static {
+ if (System.getProperty(USER_AGENT_SYSTEM_PROPERTY)!=null && !"".equals(System.getProperty(USER_AGENT_SYSTEM_PROPERTY))) {
+ DEFAULT_USER_AGENT=System.getProperty(USER_AGENT_SYSTEM_PROPERTY);
+ }
+ }
private NetworkProxy networkProxy;