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.http.client.methods.HttpGet;
23 import org.apache.http.client.methods.HttpHead;
24 import org.apache.http.client.methods.HttpPut;
25 import org.apache.http.client.methods.HttpUriRequest;
26 import org.apache.http.protocol.HTTP;
27
28
29
30
31 public class HttpConfiguration
32 {
33
34 private static final HttpMethodConfiguration DEFAULT_PUT =
35 new HttpMethodConfiguration().addParam( HTTP.EXPECT_CONTINUE, "%b,true" );
36
37 private HttpMethodConfiguration all;
38
39 private HttpMethodConfiguration get;
40
41 private HttpMethodConfiguration put;
42
43 private HttpMethodConfiguration head;
44
45 public HttpMethodConfiguration getAll()
46 {
47 return all;
48 }
49
50 public HttpConfiguration setAll( HttpMethodConfiguration all )
51 {
52 this.all = all;
53 return this;
54 }
55
56 public HttpMethodConfiguration getGet()
57 {
58 return get;
59 }
60
61 public HttpConfiguration setGet( HttpMethodConfiguration get )
62 {
63 this.get = get;
64 return this;
65 }
66
67 public HttpMethodConfiguration getPut()
68 {
69 return put;
70 }
71
72 public HttpConfiguration setPut( HttpMethodConfiguration put )
73 {
74 this.put = put;
75 return this;
76 }
77
78 public HttpMethodConfiguration getHead()
79 {
80 return head;
81 }
82
83 public HttpConfiguration setHead( HttpMethodConfiguration head )
84 {
85 this.head = head;
86 return this;
87 }
88
89 public HttpMethodConfiguration getMethodConfiguration( HttpUriRequest method )
90 {
91 if ( method instanceof HttpGet )
92 {
93 return ConfigurationUtils.merge( all, get );
94 }
95 else if ( method instanceof HttpPut )
96 {
97 return ConfigurationUtils.merge( DEFAULT_PUT, all, put );
98 }
99 else if ( method instanceof HttpHead )
100 {
101 return ConfigurationUtils.merge( all, head );
102 }
103
104 return all;
105 }
106
107 }