1 package org.apache.archiva.maven.proxy;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 import org.apache.archiva.proxy.model.NetworkProxy;
21 import org.apache.commons.lang3.StringUtils;
23 import java.util.HashMap;
27 * @author Olivier Lamy
30 public class WagonFactoryRequest
33 public static final String USER_AGENT_SYSTEM_PROPERTY = "archiva.userAgent";
35 private static String DEFAULT_USER_AGENT = "Java-Archiva";
38 * the protocol to find the Wagon for, which must be prefixed with <code>wagon#</code>, for example
39 * <code>wagon#http</code>. <b>to have a wagon supporting ntlm add -ntlm</b>
41 private String protocol;
43 private Map<String, String> headers = new HashMap<>();
45 private String userAgent = DEFAULT_USER_AGENT;
48 if ( StringUtils.isNotBlank( System.getProperty( USER_AGENT_SYSTEM_PROPERTY))) {
49 DEFAULT_USER_AGENT=System.getProperty(USER_AGENT_SYSTEM_PROPERTY);
53 private NetworkProxy networkProxy;
55 public WagonFactoryRequest()
60 public WagonFactoryRequest( String protocol, Map<String, String> headers )
62 this.protocol = protocol;
63 this.headers = headers;
66 public String getProtocol()
71 public void setProtocol( String protocol )
73 this.protocol = protocol;
76 public WagonFactoryRequest protocol( String protocol )
78 this.protocol = protocol;
82 public Map<String, String> getHeaders()
84 if ( this.headers == null )
86 this.headers = new HashMap<>();
91 public void setHeaders( Map<String, String> headers )
93 this.headers = headers;
96 public WagonFactoryRequest headers( Map<String, String> headers )
98 this.headers = headers;
102 public String getUserAgent()
107 public void setUserAgent( String userAgent )
109 this.userAgent = userAgent;
112 public WagonFactoryRequest userAgent( String userAgent )
114 this.userAgent = userAgent;
118 public NetworkProxy getNetworkProxy()
123 public void setNetworkProxy( NetworkProxy networkProxy )
125 this.networkProxy = networkProxy;
128 public WagonFactoryRequest networkProxy( NetworkProxy networkProxy )
130 this.networkProxy = networkProxy;
135 public boolean equals( Object o )
141 if ( !( o instanceof WagonFactoryRequest ) )
146 WagonFactoryRequest that = (WagonFactoryRequest) o;
148 if ( protocol != null ? !protocol.equals( that.protocol ) : that.protocol != null )
152 if ( userAgent != null ? !userAgent.equals( that.userAgent ) : that.userAgent != null )
161 public int hashCode()
163 int result = protocol != null ? protocol.hashCode() : 0;
164 result = 31 * result + ( userAgent != null ? userAgent.hashCode() : 0 );
169 public String toString()
171 return "WagonFactoryRequest{" +
172 "protocol='" + protocol + '\'' +
173 ", headers=" + headers +
174 ", userAgent='" + userAgent + '\'' +
175 ", networkProxy=" + networkProxy +