API: aj.api.http¶
-
class
aj.api.http.
BaseHttpHandler
[source]¶ Base class for everything that can process HTTP requests
-
handle
(http_context)[source]¶ Should create a HTTP response in the given
http_context
and return the plain outputParameters: http_context ( aj.http.HttpContext
) – HTTP context
-
-
class
aj.api.http.
HttpMiddleware
(context)[source]¶ -
handle
(http_context)[source]¶ Should create a HTTP response in the given
http_context
and return the plain outputParameters: http_context ( aj.http.HttpContext
) – HTTP context
-
-
class
aj.api.http.
HttpPlugin
(context)[source]¶ A base interface for HTTP request handling:
@component class HelloHttp(HttpPlugin): @url('/hello/(?P<name>.+)') def get_page(self, http_context, name=None): context.add_header('Content-Type', 'text/plain') context.respond_ok() return 'Hello, %s!' % name
-
handle
(http_context)[source]¶ Finds and executes the handler for given request context (handlers are methods decorated with
url()
)Parameters: http_context ( aj.http.HttpContext
) – HTTP contextReturns: reponse data
-
-
class
aj.api.http.
SocketEndpoint
(context)[source]¶ Base interface for Socket.IO endpoints.
-
plugin
= None¶ arbitrary plugin ID for socket message routing
-
-
aj.api.http.
url
(pattern)[source]¶ Exposes the decorated method of your
HttpPlugin
via HTTPParameters: pattern (str) – URL regex ( ^
and$
are implicit)Return type: function Named capture groups will be fed to function as
**kwargs