Clover Coverage Report - ARESTC 0.1.1-SNAPSHOT
Coverage timestamp: Sat Jul 24 2010 18:26:04 CEST
../../../../img/srcFileCovDistChart9.png 2% of files have more coverage
13   67   7   4.33
0   35   0.54   3
3     2.33  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  HTTPMethods       Line # 34 13 0% 7 2 87.5% 0.875
 
  (2)
 
1    /*
2    *
3    * (C)opyright 2010, Nikolaos Georgosopoulos
4    *
5    * This file is part of ARESTC.
6    *
7    * ARESTC is free software: you can redistribute it and/or modify it under the
8    * terms of the Lesser General Public License as published by the Free Software
9    * Foundation, either version 3 of the License, or (at your option) any later
10    * version.
11    *
12    * ARESTC is distributed in the hope that it will be useful, but WITHOUT ANY
13    * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14    * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15    *
16    * You should have received a copy of the Lesser General Public License along
17    * with ARESTC. If not, see <http://www.gnu.org/licenses/>.
18    */
19   
20    package net.sf.arestc.configuration;
21   
22    import org.apache.commons.httpclient.HttpMethod;
23    import org.apache.commons.httpclient.methods.DeleteMethod;
24    import org.apache.commons.httpclient.methods.GetMethod;
25    import org.apache.commons.httpclient.methods.HeadMethod;
26    import org.apache.commons.httpclient.methods.PostMethod;
27    import org.apache.commons.httpclient.methods.PutMethod;
28   
29    /**
30    * The Enum HTTPMethods.
31    *
32    * @author georgosn
33    */
 
34    public enum HTTPMethods {
35   
36    /** The HEAD. */
37    HEAD("{0}?{1}"), /** The GET. */
38    GET("{0}?{1}"), /** The POST. */
39    POST("{0}"), /** The DELETE. */
40    DELETE("{0}?{1}"), /** The PUT. */
41    PUT("{0}");
42   
43    private String urlPattern;
44   
 
45  5 toggle private HTTPMethods(final String pattern) {
46  5 urlPattern = pattern;
47    }
48   
 
49  5 toggle public HttpMethod getMethod(final String source) {
50  5 switch (this) {
51  1 case GET:
52  1 return new GetMethod(source);
53  1 case PUT:
54  1 return new PutMethod(source);
55  1 case POST:
56  1 return new PostMethod(source);
57  1 case DELETE:
58  1 return new DeleteMethod(source);
59  1 default:
60  1 return new HeadMethod(source);
61    }
62    }
63   
 
64  0 toggle public String getURLPattern() {
65  0 return urlPattern;
66    }
67    }