I like all the functionality of THttpServer documented here., but additionaly i would like to handle some request by myself. Is it possible? I would like to do something similar as shown in bellow
Thank you very much
I like all the functionality of THttpServer documented here., but additionaly i would like to handle some request by myself. Is it possible? I would like to do something similar as shown in bellow
Thank you very much
Hi,
Most simple way for custom requests processing - implement THttpServer::MissedRequest(THttpCallArg *arg)
in derived class.
Something like:
void TCustomHttpServer::MissedRequest(THttpCallArg *arg)
{
if (!strcmp(arg->GetPathName(), "custom_path") &&
!strcmp(arg->GetFileName(), "empty_object.json")) {
arg->SetJsonContent("{}");
} else {
THttpServer::MissedRequest(arg);
}
}
There are several methods in THttpCallArg class to set content and type of content for http requests.
Regards,
Sergey
And what do i need to do to fill response? Should i fill arg with new values?
No, just set content and content type.
These values will be used when server replies http request.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.