app :: MyHttpRequest
app :: MyHttpRequest :: defaultinit
app :: MyHttpRequest :: win
Back reference to the window to show feedback to the userapp :: MyHttpRequest :: win=
Back reference to the window to show feedback to the userapp $ MyHttpRequest :: SELF
Type of this instance, automatically specialized in every classapp $ MyHttpRequest :: before
Prepare the UI or other parts of the program before executing the REST requestapp $ MyHttpRequest :: deserialize_json
Should the response content be deserialized from JSON?app $ MyHttpRequest :: on_fail
Invoked when the HTTP request has failed and no data was received or deserialization failedapp $ MyHttpRequest :: uri
URI target of this request, by default it is composed ofuri_root / uri_tail
app :: AsyncHttpRequest :: before
Prepare the UI or other parts of the program before executing the REST requestcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
app :: MyHttpRequest :: defaultinit
pthreads :: Thread :: defaultinit
app :: AsyncHttpRequest :: defaultinit
core :: Finalizable :: defaultinit
core :: Object :: defaultinit
app :: AsyncHttpRequest :: delay=
Delay in seconds before sending this requestapp :: AsyncHttpRequest :: deserialize_json
Should the response content be deserialized from JSON?app :: AsyncHttpRequest :: deserialize_json=
Should the response content be deserialized from JSON?core :: Finalizable :: finalize
Liberate any resources held byself
before the memory holding self
is freed
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
app :: AsyncHttpRequest :: on_fail
Invoked when the HTTP request has failed and no data was received or deserialization failedcore :: Object :: output_class_name
Display class name on stdout (debug only).app :: AsyncHttpRequest :: uri
URI target of this request, by default it is composed ofuri_root / uri_tail
app :: AsyncHttpRequest :: uri_root
Root URI of the remote server, usually the scheme and remote hostapp :: AsyncHttpRequest :: uri_tail
Right part of the URI, afteruri_root
, often the resource path and the query
app :: MyHttpRequest :: win
Back reference to the window to show feedback to the userapp :: MyHttpRequest :: win=
Back reference to the window to show feedback to the user
# Simple asynchronous HTTP request to http://example.com/ displaying feedback to the window
class MyHttpRequest
super AsyncHttpRequest
# Back reference to the window to show feedback to the user
var win: HttpRequestClientWindow
# ---
# Config the request
redef fun uri do return "http://example.com/"
redef fun deserialize_json do return false
# ---
# Customize callbacks
redef fun before
do
win.label_response.text = "Sending request..."
# Disable button to prevent double requests
win.button_request.enabled = false
end
redef fun on_load(data, status)
do win.label_response.text = "Received response code {status} with {data.as(Text).byte_length} bytes"
redef fun on_fail(error)
do win.label_response.text = "Connection error: {error}"
redef fun after do win.button_request.enabled = true
end
lib/app/examples/http_request_example.nit:27,1--58,3