Clover Coverage Report - Atlassian XWork(Aggregated)
Coverage timestamp: Wed Jul 27 2011 23:39:31 CDT
11   104   9   2.2
4   65   0.82   5
5     1.8  
1    
 
 
  HttpMethod       Line # 12 11 9 100% 1.0
 
  (4)
 
1    package com.atlassian.xwork;
2   
3    import java.util.EnumSet;
4   
5    /**
6    * Enumeration of the different HTTP methods used by the {@link com.atlassian.xwork.interceptors.RestrictHttpMethodInterceptor}.
7    * Because this enumeration is designed for the use of the interceptor (for example it treats HEAD as a sub-method
8    * of GET), it probably isn't useful for more general cases.
9    *
10    * @since 1.6
11    */
 
12    public enum HttpMethod
13    {
14    // Standard HTTP Methods
15   
16    /** RFC2616 GET method. Will also match HEAD, as HEAD should be accepted anywhere GET is */
17    GET
18    {
 
19  111 toggle @Override
20    public boolean matches(String methodName)
21    {
22  111 return super.matches(methodName) || HEAD.matches(methodName);
23    }
24    },
25    /** RFC2616 POST method */
26    POST,
27    /** RFC2616 PUT method */
28    PUT,
29    /** RFC2616 DELETE method */
30    DELETE,
31    /** RFC2616 HEAD method */
32    HEAD,
33    /** RFC2616 OPTIONS method */
34    OPTIONS,
35    /** RFC2616 TRACE method */
36    TRACE,
37    /** RFC2616 CONNECT method */
38    CONNECT,
39   
40    // WEBDAV methods
41   
42    /** RFC2518 PROPFIND method */
43    PROPFIND,
44    /** RFC2518 PROPPATCH method */
45    PROPPATCH,
46    /** RFC2518 MKCOL method */
47    MKCOL,
48    /** RFC2518 COPY method */
49    COPY,
50    /** RFC2518 MOVE method */
51    MOVE,
52    /** RFC2518 LOCK method */
53    LOCK,
54    /** RFC2518 UNLOCK method */
55    UNLOCK,
56    /** RFC2518 PATCH method */
57    PATCH,
58   
59    /** Matches any method defined in standard HTTP/1.1 */
60    ALL_RFC2616
61    {
 
62  24 toggle @Override
63    public boolean matches(String methodName)
64    {
65  24 for (HttpMethod method: EnumSet.range(GET, CONNECT))
66    {
67  111 if (method.matches(methodName))
68  12 return true;
69    }
70   
71  12 return false;
72    }},
73   
74    /** Matches any method defined in standard HTTP/1.1 or WEBDAV */
75    ALL_DEFINED
76    {
 
77  9 toggle @Override
78    public boolean matches(String methodName)
79    {
80  9 for (HttpMethod method: EnumSet.range(GET, PATCH))
81    {
82  78 if (method.matches(methodName))
83  6 return true;
84    }
85   
86  3 return false;
87    }
88    },
89   
90    /** Accept anything, even if it's not defined in this enumeration */
91    ANY_METHOD
92    {
 
93  24 toggle @Override
94    public boolean matches(String methodName)
95    {
96  24 return true;
97    }
98    };
99   
 
100  467 toggle public boolean matches(String methodName)
101    {
102  467 return methodName != null && this.toString().equals(methodName);
103    }
104    }