Noob question:

Noob question:
Is there a cleaner way to insert a JsonRPC request handler into a TWebModule?
Note - Insert as an action in code, and not at design time.

procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
if (Request.MethodType = mtPost) and (Request.ContentType = 'application/json') and (Request.PathInfo = '/')
then begin
JsonRPC.Invoke(Sender, Request, Response, Handled);
end
else begin
Response.Content := {"",""}
'' +
'Nothing to see' +
'Move along' +
'';
end;
end;

Comments

Post a Comment