A Rooter dedicated to APIHandlers.

Introduced properties

private var _config: NitwebConfig

nitc :: APIRouter :: _config

App config
fun config: NitwebConfig

nitc :: APIRouter :: config

App config
protected fun config=(config: NitwebConfig)

nitc :: APIRouter :: config=

App config

Redefined properties

redef type SELF: APIRouter

nitc $ APIRouter :: SELF

Type of this instance, automatically specialized in every class
redef init init

nitc :: api_light $ APIRouter :: init

redef init init

nitc :: api_model $ APIRouter :: init

redef init init

nitc :: api_docdown $ APIRouter :: init

redef init init

nitc :: api_auth $ APIRouter :: init

redef init init

nitc :: api_feedback $ APIRouter :: init

redef init init

nitc :: api_metrics $ APIRouter :: init

redef init init

nitc :: api $ APIRouter :: init

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 BODY: Serializable

popcorn :: Handler :: BODY

Kind of objects returned by deserialize_body
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
private var _body_type: String

popcorn :: Handler :: _body_type

private var _config: NitwebConfig

nitc :: APIRouter :: _config

App config
private var _handlers: Map[AppRoute, Handler]

popcorn :: Router :: _handlers

List of handlers to match with requests.
private var _post_handlers: Map[AppRoute, Handler]

popcorn :: Router :: _post_handlers

List of handlers to match after every other.
private var _pre_handlers: Map[AppRoute, Handler]

popcorn :: Router :: _pre_handlers

List of handlers to match before every other.
private var _validator: nullable DocumentValidator

popcorn :: Handler :: _validator

Validator used to check body input
fun all(req: HttpRequest, res: HttpResponse)

popcorn :: Handler :: all

Handler to all kind of HTTP request methods.
private fun body_type: String

popcorn :: Handler :: body_type

private fun body_type=(body_type: String)

popcorn :: Handler :: body_type=

private fun build_route(handler: Handler, path: String): AppRoute

popcorn :: Router :: build_route

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 config: NitwebConfig

nitc :: APIRouter :: config

App config
protected fun config=(config: NitwebConfig)

nitc :: APIRouter :: config=

App config
fun delete(req: HttpRequest, res: HttpResponse)

popcorn :: Handler :: delete

DELETE handler.
fun deserialize_body(req: HttpRequest, res: HttpResponse): nullable BODY

popcorn :: Handler :: deserialize_body

Deserialize the request body
fun get(req: HttpRequest, res: HttpResponse)

popcorn :: Handler :: get

GET handler.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
private fun handle(route: AppRoute, uri: String, req: HttpRequest, res: HttpResponse)

popcorn :: Handler :: handle

Call all(req, res) if route matches uri.
private fun handle_in(route: AppRoute, uri: String, req: HttpRequest, res: HttpResponse)

popcorn :: Router :: handle_in

private fun handle_post(route: AppRoute, uri: String, req: HttpRequest, res: HttpResponse)

popcorn :: Router :: handle_post

private fun handle_pre(route: AppRoute, uri: String, req: HttpRequest, res: HttpResponse)

popcorn :: Router :: handle_pre

private fun handlers: Map[AppRoute, Handler]

popcorn :: Router :: handlers

List of handlers to match with requests.
private fun handlers=(handlers: Map[AppRoute, Handler])

popcorn :: Router :: handlers=

List of handlers to match with requests.
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.
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
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 post(req: HttpRequest, res: HttpResponse)

popcorn :: Handler :: post

POST handler.
private fun post_handlers: Map[AppRoute, Handler]

popcorn :: Router :: post_handlers

List of handlers to match after every other.
private fun post_handlers=(post_handlers: Map[AppRoute, Handler])

popcorn :: Router :: post_handlers=

List of handlers to match after every other.
private fun pre_handlers: Map[AppRoute, Handler]

popcorn :: Router :: pre_handlers

List of handlers to match before every other.
private fun pre_handlers=(pre_handlers: Map[AppRoute, Handler])

popcorn :: Router :: pre_handlers=

List of handlers to match before every other.
fun put(req: HttpRequest, res: HttpResponse)

popcorn :: Handler :: put

PUT handler.
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.
fun use(path: String, handler: Handler)

popcorn :: Router :: use

Register a handler for a route path.
fun use_after(path: String, handler: Handler)

popcorn :: Router :: use_after

Register a post-handler for a route path.
fun use_before(path: String, handler: Handler)

popcorn :: Router :: use_before

Register a pre-handler for a route path.
fun validate_body(req: HttpRequest, res: HttpResponse): nullable String

popcorn :: Handler :: validate_body

Validate body input with validator
fun validator: nullable DocumentValidator

popcorn :: Handler :: validator

Validator used to check body input
protected fun validator=(validator: nullable DocumentValidator)

popcorn :: Handler :: validator=

Validator used to check body input
package_diagram nitc::APIRouter APIRouter popcorn::Router Router nitc::APIRouter->popcorn::Router popcorn::Handler Handler popcorn::Router->popcorn::Handler ...popcorn::Handler ... ...popcorn::Handler->popcorn::Handler

Ancestors

abstract class Handler

popcorn :: Handler

Class handler for a route.
interface Object

core :: Object

The root of the class hierarchy.

Parents

class Router

popcorn :: Router

Mountable routers

Class definitions

nitc $ APIRouter
# A Rooter dedicated to APIHandlers.
class APIRouter
	super Router

	# App config
	var config: NitwebConfig
end
src/doc/api/api_base.nit:127,1--133,3

nitc :: api_light $ APIRouter
redef class APIRouter
	redef init do
		super
		use("/light/", new APILight(config))
	end
end
src/doc/api/api_light.nit:20,1--25,3

nitc :: api_model $ APIRouter
redef class APIRouter
	redef init do
		super
		use("/list", new APIList(config))
		use("/random", new APIRandom(config))
		use("/search", new APISearch(config))

		use("/entity/:id", new APIEntity(config))
		use("/doc/:id", new APIEntityDoc(config))
		use("/code/:id", new APIEntityCode(config))
		use("/lin/:id", new APIEntityLinearization(config))
		use("/defs/:id", new APIEntityDefs(config))
		use("/intros/:id", new APIEntityIntros(config))
		use("/redefs/:id", new APIEntityRedefs(config))
		use("/meta/:id", new APIEntityMetadata(config))
		use("/all/:id", new APIEntityAll(config))

		use("/ancestors/:id", new APIEntityAncestors(config))
		use("/parents/:id", new APIEntityParents(config))
		use("/children/:id", new APIEntityChildren(config))
		use("/descendants/:id", new APIEntityDescendants(config))

		use("/uml/:id", new APIEntityUML(config))
		use("/graph/inheritance/:id", new APIInheritanceGraph(config))

		use("/catalog/packages/", new APICatalogPackages(config))
		use("/catalog/stats", new APICatalogStats(config))
		use("/catalog/tags", new APICatalogTags(config))
		use("/catalog/tag/:tid", new APICatalogTag(config))
		use("/catalog/person/:pid", new APICatalogPerson(config))
		use("/catalog/person/:pid/maintaining", new APICatalogMaintaining(config))
		use("/catalog/person/:pid/contributing", new APICatalogContributing(config))

		use("/ini/desc/:id", new APIIniDesc(config))
		use("/ini/git/:id", new APIIniGit(config))
		use("/ini/clone/:id", new APIIniClone(config))
		use("/ini/issues/:id", new APIIniIssues(config))
		use("/ini/maintainer/:id", new APIIniMaintainer(config))
		use("/ini/contributors/:id", new APIIniContributors(config))
		use("/ini/license/:id", new APIIniLicense(config))
		use("/ini/license-file/:id", new APIIniLicenseFile(config))
		use("/ini/license-content/:id", new APIIniLicenseFileContent(config))
		use("/ini/contrib-file/:id", new APIIniContribFile(config))
		use("/ini/contrib-content/:id", new APIIniContribFileContent(config))
	end
end
src/doc/api/api_model.nit:19,1--64,3

nitc :: api_auth $ APIRouter
redef class APIRouter
	redef init do
		super
		use("/user", new GithubUser)
	end
end
src/doc/api/api_auth.nit:35,1--40,3

nitc :: api_metrics $ APIRouter
redef class APIRouter
	redef init do
		super
		use("/metrics/structural/:id", new APIStructuralMetrics(config))
	end
end
src/doc/api/api_metrics.nit:20,1--25,3

nitc :: api_docdown $ APIRouter
redef class APIRouter
	redef init do
		super
		use("/docdown/", new APIDocdown(config))
	end
end
src/doc/api/api_docdown.nit:31,1--36,3

nitc :: api $ APIRouter
redef class APIRouter
	redef init do
		super
		use("/*", new APIErrorHandler(config)) # catch 404 errors
	end
end
src/doc/api/api.nit:25,1--30,3