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