All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.darwinsys.net.HttpStatus Maven / Gradle / Ivy

package com.darwinsys.net;

/**
 * Yer basic HTTP status code enum. Started from
 * http://en.wikipedia.org/wiki/list_of_http_status_codes
 * Converted by:
 * g/^    /d
 * tr a-z A-Z 
 * awk '
		/^[0-9]/ { print $2 "(" $1 "),", $3, $4, $5, $6; next }
		{print}
		'
 * and a bit of post-editing.
 */
public enum HttpStatus {

	// 1xx BASIC

	CONTINUE(100),
	SWITCHING_PROTOCOLS(101),
	PROCESSING(102), // WEBDAV; RFC2518

	// 2XX SUCCESS

	OK(200),
	CREATED(201),
	ACCEPTED(202),
	NON_AUTHORITATIVE_INFORMATION(203), // SINCE // HTTP/1.1
	NO_CONTENT(204),
	RESET_CONTENT(205),
	PARTIAL_CONTENT(206),
	MULTI_STATUS(207), // WEBDAV RFC-4918
	ALREADY_REPORTED(208), // WEBDAV; RFC 5842
	IM_USED(226), // RFC 3229

	// 3XX REDIRECTION

	MULTIPLE_CHOICES(300),
	MOVED_PERMANENTLY(301),
	FOUND(302),
	SEE_OTHER(303), // SINCE HTTP/1.1
	NOT_MODIFIED(304),
	USE_PROXY(305), // SINCE HTTP/1.1
	SWITCH_PROXY(306),
	TEMPORARY_REDIRECT(307), // SINCE HTTP/1.1
	PERMANENT_REDIRECT_X(308), // APPROVED AS EXPERIMENTAL

	// 4XX CLIENT ERROR

	BAD_REQUEST(400),
	UNAUTHORIZED(401),
	PAYMENT_REQUIRED(402),
	FORBIDDEN(403),
	NOT_FOUND(404),
	METHOD_NOT_ALLOWED(405),
	NOT_ACCEPTABLE(406),
	PROXY_AUTHENTICATION_REQUIRED(407),
	REQUEST_TIMEOUT(408),
	CONFLICT(409),
	GONE(410),
	LENGTH_REQUIRED(411),
	PRECONDITION_FAILED(412),
	REQUEST_ENTITY_TOO_LARGE(413),
	REQUEST_URI_TOO_LONG(414),
	UNSUPPORTED_MEDIA_TYPE(415),
	REQUESTED_RANGE_NOT_SATISFIABLE(416),
	EXPECTATION_FAILED(417),
	I_M_A_TEAPOT(418), // RFC 2324
	AUTHENTICATION_TIMEOUT(419), // NOT IN RFC
	METHOD_FAILURE_SPRING(420), // SPRING FRAMEWORK
	ENHANCE_YOUR_CALM(420), // TWITTER
	UNPROCESSABLE_ENTITY(422), // WEBDAV; RFC 4918
	LOCKED(423), // WEBDAV; RFC 4918
	FAILED_DEPENDENCY(424), // WEBDAV; RFC 4918
	METHOD_FAILURE_WEBDAV(424), // WEBDAV)[14]
	UNORDERED_COLLECTION(425), // INTERNET DRAFT
	UPGRADE_REQUIRED(426), // RFC 2817
	PRECONDITION_REQUIRED(428), // RFC 6585
	TOO_MANY_REQUESTS(429), // RFC 6585
	REQUEST_HEADER_FIELDS_TOO_LARGE(431), // RFC 6585
	LOGIN_TIMEOUT(440), // MICROSOFT
	NO_RESPONSE(444), // NGINX
	RETRY_WITH(449), // MICROSOFT
	BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS(450), // MICROSOFT
	UNAVAILABLE_FOR_LEGAL_REASONS(451), // INTERNET DRAFT
	REDIRECT(451), // MICROSOFT
	REQUEST_HEADER_TOO_LARGE(494), // NGINX
	CERT_ERROR(495), // NGINX
	NO_CERT(496), // NGINX
	HTTP_TO_HTTPS(497), // NGINX
	CLIENT_CLOSED_REQUEST(499), // NGINX

	// 5XX SERVER ERROR

	INTERNAL_SERVER_ERROR(500),
	NOT_IMPLEMENTED(501),
	BAD_GATEWAY(502),
	SERVICE_UNAVAILABLE(503),
	GATEWAY_TIMEOUT(504),
	HTTP_VERSION_NOT_SUPPORTED(505),
	VARIANT_ALSO_NEGOTIATES(506), // RFC 2295
	INSUFFICIENT_STORAGE(507), // WEBDAV; RFC 4918
	LOOP_DETECTED(508), // WEBDAV; RFC 5842
	BANDWIDTH_LIMIT_EXCEEDED(509), // APACHE BW/LIMITED EXTENSION
	NOT_EXTENDED(510), // RFC 2774
	NETWORK_AUTHENTICATION_REQUIRED(511), // RFC 6585
	ORIGIN_ERROR(520), // CLOUDFLARE
	CONNECTION_TIMED_OUT(522),
	PROXY_DECLINED_REQUEST(523), // CLOUDFLARE
	A_TIMEOUT_OCCURRED(524), // CLOUDFLARE
	NETWORK_READ_TIMEOUT_ERROR(598), // UNKNOWN
	NETWORK_CONNECT_TIMEOUT_ERROR(599); // UNKNOWN

	HttpStatus(int value) {
		this.value = value;
	}

	private final int value;

	public int value() {
		return value;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy