1 | |
package org.apache.maven.wagon.providers.http; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.wagon.ConnectionException; |
23 | |
import org.apache.maven.wagon.authentication.AuthenticationException; |
24 | |
import org.apache.maven.wagon.proxy.ProxyInfo; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
public class LightweightHttpsWagon |
37 | |
extends LightweightHttpWagon |
38 | |
{ |
39 | |
private String previousHttpsProxyHost; |
40 | |
|
41 | |
private String previousHttpsProxyPort; |
42 | |
|
43 | |
private String previousHttpsProxyExclusions; |
44 | |
|
45 | |
public LightweightHttpsWagon() |
46 | |
{ |
47 | 59 | super(); |
48 | 59 | } |
49 | |
|
50 | |
public void openConnection() |
51 | |
throws ConnectionException, AuthenticationException |
52 | |
{ |
53 | 55 | previousHttpsProxyHost = System.getProperty( "https.proxyHost" ); |
54 | 55 | previousHttpsProxyPort = System.getProperty( "https.proxyPort" ); |
55 | 55 | previousHttpsProxyExclusions = System.getProperty( "https.nonProxyHosts" ); |
56 | |
|
57 | 55 | final ProxyInfo proxyInfo = getProxyInfo( "https", getRepository().getHost() ); |
58 | 55 | if ( proxyInfo != null ) |
59 | |
{ |
60 | 0 | setSystemProperty( "https.proxyHost", proxyInfo.getHost() ); |
61 | 0 | setSystemProperty( "https.proxyPort", String.valueOf( proxyInfo.getPort() ) ); |
62 | 0 | setSystemProperty( "https.nonProxyHosts", proxyInfo.getNonProxyHosts() ); |
63 | |
} |
64 | |
else |
65 | |
{ |
66 | 55 | setSystemProperty( "https.proxyHost", null ); |
67 | 55 | setSystemProperty( "https.proxyPort", null ); |
68 | |
} |
69 | |
|
70 | 55 | super.openConnection(); |
71 | 55 | } |
72 | |
|
73 | |
public void closeConnection() |
74 | |
throws ConnectionException |
75 | |
{ |
76 | 55 | super.closeConnection(); |
77 | |
|
78 | 55 | setSystemProperty( "https.proxyHost", previousHttpsProxyHost ); |
79 | 55 | setSystemProperty( "https.proxyPort", previousHttpsProxyPort ); |
80 | 55 | setSystemProperty( "https.nonProxyHosts", previousHttpsProxyExclusions ); |
81 | 55 | } |
82 | |
} |