1 23 24 package org.apache.slide.webdav.util; 25 26 import java.util.Hashtable ; 27 28 public class WebdavStatus { 29 30 31 33 34 private static Hashtable mapStatusCodes = new Hashtable (); 35 36 37 39 40 public static String getStatusText(int nHttpStatusCode) { 41 Integer intKey = new Integer (nHttpStatusCode); 42 43 if (!mapStatusCodes.containsKey(intKey)) { 44 return null; 46 47 } else { 48 return (String ) mapStatusCodes.get(intKey); 49 } 50 } 51 52 53 55 56 private static void addStatusCodeMap(int nKey, String strVal) { 57 mapStatusCodes.put(new Integer (nKey), strVal); 58 } 59 60 61 63 64 public static final int SC_CONTINUE = 100; 65 public static final int SC_SWITCHING_PROTOCOLS = 101; 66 public static final int SC_PROCESSING = 102; 67 68 public static final int SC_OK = 200; 69 public static final int SC_CREATED = 201; 70 public static final int SC_ACCEPTED = 202; 71 public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203; 72 public static final int SC_NO_CONTENT = 204; 73 public static final int SC_RESET_CONTENT = 205; 74 public static final int SC_PARTIAL_CONTENT = 206; 75 public static final int SC_MULTI_STATUS = 207; 76 79 public static final int SC_MULTIPLE_CHOICES = 300; 80 public static final int SC_MOVED_PERMANENTLY = 301; 81 public static final int SC_MOVED_TEMPORARILY = 302; 82 public static final int SC_SEE_OTHER = 303; 83 public static final int SC_NOT_MODIFIED = 304; 84 public static final int SC_USE_PROXY = 305; 85 86 public static final int SC_BAD_REQUEST = 400; 87 public static final int SC_UNAUTHORIZED = 401; 88 public static final int SC_PAYMENT_REQUIRED = 402; 89 public static final int SC_FORBIDDEN = 403; 90 public static final int SC_NOT_FOUND = 404; 91 public static final int SC_METHOD_NOT_ALLOWED = 405; 92 public static final int SC_NOT_ACCEPTABLE = 406; 93 public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407; 94 public static final int SC_REQUEST_TIMEOUT = 408; 95 public static final int SC_CONFLICT = 409; 96 public static final int SC_GONE = 410; 97 public static final int SC_LENGTH_REQUIRED = 411; 98 public static final int SC_PRECONDITION_FAILED = 412; 99 public static final int SC_REQUEST_TOO_LONG = 413; 100 public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415; 101 public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416; 102 public static final int SC_EXPECTATION_FAILED = 417; 103 public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419; 107 public static final int SC_METHOD_FAILURE = 420; 110 public static final int SC_UNPROCESSABLE_ENTITY = 422; 111 public static final int SC_LOCKED = 423; 112 public static final int SC_FAILED_DEPENDENCY = 424; 113 114 public static final int SC_INTERNAL_SERVER_ERROR = 500; 115 public static final int SC_NOT_IMPLEMENTED = 501; 116 public static final int SC_BAD_GATEWAY = 502; 117 public static final int SC_SERVICE_UNAVAILABLE = 503; 118 public static final int SC_GATEWAY_TIMEOUT = 504; 119 public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505; 120 public static final int SC_INSUFFICIENT_STORAGE = 507; 121 122 123 125 126 static { 127 addStatusCodeMap(SC_OK, "OK"); 129 addStatusCodeMap(SC_CREATED, "Created"); 130 addStatusCodeMap(SC_ACCEPTED, "Accepted"); 131 addStatusCodeMap(SC_NO_CONTENT, "No Content"); 132 addStatusCodeMap(SC_MOVED_PERMANENTLY, "Moved Permanently"); 133 addStatusCodeMap(SC_MOVED_TEMPORARILY, "Moved Temporarily"); 134 addStatusCodeMap(SC_NOT_MODIFIED, "Not Modified"); 135 addStatusCodeMap(SC_BAD_REQUEST, "Bad Request"); 136 addStatusCodeMap(SC_UNAUTHORIZED, "Unauthorized"); 137 addStatusCodeMap(SC_FORBIDDEN, "Forbidden"); 138 addStatusCodeMap(SC_NOT_FOUND, "Not Found"); 139 addStatusCodeMap(SC_INTERNAL_SERVER_ERROR, "Internal Server Error"); 140 addStatusCodeMap(SC_NOT_IMPLEMENTED, "Not Implemented"); 141 addStatusCodeMap(SC_BAD_GATEWAY, "Bad Gateway"); 142 addStatusCodeMap(SC_SERVICE_UNAVAILABLE, "Service Unavailable"); 143 144 addStatusCodeMap(SC_CONTINUE, "Continue"); 146 addStatusCodeMap(SC_METHOD_NOT_ALLOWED, "Method Not Allowed"); 147 addStatusCodeMap(SC_NOT_ACCEPTABLE, "Not Acceptable"); 148 addStatusCodeMap(SC_CONFLICT, "Conflict"); 149 addStatusCodeMap(SC_PRECONDITION_FAILED, "Precondition Failed"); 150 addStatusCodeMap(SC_REQUEST_TOO_LONG, "Request Too Long"); 151 addStatusCodeMap(SC_UNSUPPORTED_MEDIA_TYPE, "Unsupported Media Type"); 152 addStatusCodeMap(SC_REQUESTED_RANGE_NOT_SATISFIABLE, "Requested Range Not Satisfiable"); 153 154 addStatusCodeMap(SC_SWITCHING_PROTOCOLS, "Switching Protocols"); 155 addStatusCodeMap(SC_NON_AUTHORITATIVE_INFORMATION, 156 "Non Authoritative Information"); 157 addStatusCodeMap(SC_RESET_CONTENT, "Reset Content"); 158 addStatusCodeMap(SC_GATEWAY_TIMEOUT, "Gateway Timeout"); 159 addStatusCodeMap(SC_HTTP_VERSION_NOT_SUPPORTED, 160 "Http Version Not Supported"); 161 162 addStatusCodeMap(SC_PROCESSING, "Processing"); 164 addStatusCodeMap(SC_MULTI_STATUS, "Multi-Status"); 165 addStatusCodeMap(SC_UNPROCESSABLE_ENTITY, "Unprocessable Entity"); 166 addStatusCodeMap(SC_INSUFFICIENT_SPACE_ON_RESOURCE, 167 "Insufficient Space On Resource"); 168 addStatusCodeMap(SC_METHOD_FAILURE, "Method Failure"); 169 addStatusCodeMap(SC_LOCKED, "Locked"); 170 addStatusCodeMap(SC_INSUFFICIENT_STORAGE , "Insufficient Storage"); 171 addStatusCodeMap(SC_FAILED_DEPENDENCY, "Failed Dependency"); 172 } 173 174 175 } 176 | Popular Tags |