Helper class to associate HTTP status code to their message

You probably want the default instance available as the top-level method http_status_codes.

Introduced properties

fun [](code: Int): nullable String

nitcorn :: HttpStatusCodes :: []

Get the message associated to the status code, return null in unknown
fun codes: HashMap[Int, String]

nitcorn :: HttpStatusCodes :: codes

All know code and their message
protected fun codes=(codes: HashMap[Int, String])

nitcorn :: HttpStatusCodes :: codes=

All know code and their message
protected init defaultinit

nitcorn :: HttpStatusCodes :: defaultinit

Init the status codes list.

Redefined properties

redef type SELF: HttpStatusCodes

nitcorn $ HttpStatusCodes :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun [](code: Int): nullable String

nitcorn :: HttpStatusCodes :: []

Get the message associated to the status code, return null in unknown
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun codes: HashMap[Int, String]

nitcorn :: HttpStatusCodes :: codes

All know code and their message
protected fun codes=(codes: HashMap[Int, String])

nitcorn :: HttpStatusCodes :: codes=

All know code and their message
protected init defaultinit

nitcorn :: HttpStatusCodes :: defaultinit

Init the status codes list.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram nitcorn::HttpStatusCodes HttpStatusCodes core::Object Object nitcorn::HttpStatusCodes->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

nitcorn $ HttpStatusCodes
# Helper class to associate HTTP status code to their message
#
# You probably want the default instance available as the top-level method
# `http_status_codes`.
class HttpStatusCodes

	# All know code and their message
	var codes = new HashMap[Int, String]

	# Init the status `codes` list.
	protected init is old_style_init do insert_status_codes

	# Get the message associated to the status `code`, return `null` in unknown
	fun [](code: Int): nullable String
	do
		if codes.keys.has(code) then
			return codes[code]
		else return null
	end

	private fun insert_status_codes
	do
		codes[100] = "Continue"
		codes[101] = "Switching Protocols"
		codes[200] = "OK"
		codes[201] = "Created"
		codes[202] = "Accepted"
		codes[203] = "Non-Authoritative Information"
		codes[204] = "No Content"
		codes[205] = "Reset Content"
		codes[206] = "Partial Content"
		codes[300] = "Multiple Choices"
		codes[301] = "Moved Permanently"
		codes[302] = "Found"
		codes[303] = "See Other"
		codes[304] = "Not Modified"
		codes[305] = "Use Proxy"
		codes[307] = "Temporary Redirect"
		codes[400] = "Bad Request"
		codes[401] = "Unauthorized"
		codes[402] = "Payment Requred"
		codes[403] = "Forbidden"
		codes[404] = "Not Found"
		codes[405] = "Method Not Allowed"
		codes[406] = "Not Acceptable"
		codes[407] = "Proxy Authentication Required"
		codes[408] = "Request Timeout"
		codes[409] = "Conflict"
		codes[410] = "Gone"
		codes[411] = "Length Required"
		codes[412] = "Precondition Failed"
		codes[413] = "Request Entity Too Large"
		codes[414] = "Request-URI Too Long"
		codes[415] = "Unsupported Media Type"
		codes[416] = "Requested Range Not Satisfiable"
		codes[417] = "Expectation Failed"
		codes[500] = "Internal Server Error"
		codes[501] = "Not Implemented"
		codes[502] = "Bad Gateway"
		codes[503] = "Service Unavailable"
		codes[504] = "Gateway Timeout"
		codes[505] = "HTTP Version Not Supported"
	end
end
lib/nitcorn/http_response.nit:109,1--172,3