01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: RequestMethod.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine;
09:
10: import com.uwyn.rife.datastructures.EnumClass;
11:
12: public class RequestMethod extends EnumClass<String> {
13: public static final RequestMethod GET = new RequestMethod("GET");
14: public static final RequestMethod POST = new RequestMethod("POST");
15: public static final RequestMethod HEAD = new RequestMethod("HEAD");
16: public static final RequestMethod TRACE = new RequestMethod("TRACE");
17: public static final RequestMethod PUT = new RequestMethod("PUT");
18: public static final RequestMethod DELETE = new RequestMethod(
19: "DELETE");
20: public static final RequestMethod OPTIONS = new RequestMethod(
21: "OPTIONS");
22: public static final RequestMethod EXIT = new RequestMethod("EXIT");
23: public static final RequestMethod PRECEDENCE = new RequestMethod(
24: "PRECEDENCE");
25:
26: // WebDAV methods
27: public static final RequestMethod PROPFIND = new RequestMethod(
28: "PROPFIND");
29: public static final RequestMethod PROPPATCH = new RequestMethod(
30: "PROPPATCH");
31: public static final RequestMethod MKCOL = new RequestMethod("MKCOL");
32: public static final RequestMethod COPY = new RequestMethod("COPY");
33: public static final RequestMethod MOVE = new RequestMethod("MOVE");
34: public static final RequestMethod LOCK = new RequestMethod("LOCK");
35: public static final RequestMethod UNLOCK = new RequestMethod(
36: "UNLOCK");
37:
38: RequestMethod(String identifier) {
39: super (identifier);
40: }
41:
42: public static RequestMethod getMethod(String name) {
43: if (null == name) {
44: return GET;
45: }
46:
47: name = name.toUpperCase();
48: RequestMethod method = getMember(RequestMethod.class, name);
49: if (null == method) {
50: method = new RequestMethod(name);
51: }
52: return method;
53: }
54: }
|