View Javadoc
1   package org.apache.maven.wagon.shared.http;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.http.client.methods.HttpUriRequest;
23  
24  /**
25   *
26   */
27  public class HttpConfiguration
28  {
29  
30      private HttpMethodConfiguration all;
31  
32      private HttpMethodConfiguration get;
33  
34      private HttpMethodConfiguration put;
35  
36      private HttpMethodConfiguration head;
37  
38      private HttpMethodConfiguration mkcol;
39  
40      public HttpMethodConfiguration getAll()
41      {
42          return all;
43      }
44  
45      public HttpConfiguration setAll( HttpMethodConfiguration all )
46      {
47          this.all = all;
48          return this;
49      }
50  
51      public HttpMethodConfiguration getGet()
52      {
53          return get;
54      }
55  
56      public HttpConfiguration setGet( HttpMethodConfiguration get )
57      {
58          this.get = get;
59          return this;
60      }
61  
62      public HttpMethodConfiguration getPut()
63      {
64          return put;
65      }
66  
67      public HttpConfiguration setPut( HttpMethodConfiguration put )
68      {
69          this.put = put;
70          return this;
71      }
72  
73      public HttpMethodConfiguration getHead()
74      {
75          return head;
76      }
77  
78      public HttpConfiguration setHead( HttpMethodConfiguration head )
79      {
80          this.head = head;
81          return this;
82      }
83  
84      public HttpMethodConfiguration getMkcol()
85      {
86          return mkcol;
87      }
88  
89      public HttpConfiguration setMkcol( HttpMethodConfiguration mkcol )
90      {
91          this.mkcol = mkcol;
92          return this;
93      }
94  
95      public HttpMethodConfiguration getMethodConfiguration( HttpUriRequest method )
96      {
97          switch ( method.getMethod() )
98          {
99          case "GET":
100             return ConfigurationUtils.merge( all, get );
101         case "PUT":
102             return ConfigurationUtils.merge( all, put );
103         case "HEAD":
104             return ConfigurationUtils.merge( all, head );
105         case "MKCOL":
106             return ConfigurationUtils.merge( all, mkcol );
107         default:
108             return all;
109         }
110     }
111 
112 }