mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 10:19:30 +02:00
* Publish handler resulttype, add OnContextExecute
This commit is contained in:
parent
9af13b2731
commit
03b3f00a0b
@ -118,21 +118,25 @@ Type
|
||||
TCustomJSONRPCHandlerClass = Class of TCustomJSONRPCHandler;
|
||||
|
||||
TJSONRPCEvent = Procedure (Sender : TObject; Const Params : TJSONData; Out Res : TJSONData) of object;
|
||||
TJSONContextRPCEvent = Procedure (Sender : TObject; aContext : TJSONRPCCallContext; Const Params : TJSONData; Out Res : TJSONData) of object;
|
||||
|
||||
{ TJSONRPCHandler }
|
||||
|
||||
TJSONRPCHandler = Class(TCustomJSONRPCHandler)
|
||||
private
|
||||
FOnExecute: TJSONRPCEvent;
|
||||
FOnContextExecute : TJSONContextRPCEvent;
|
||||
protected
|
||||
Function DoExecute(Const Params : TJSONData; AContext : TJSONRPCCallContext): TJSONData; override;
|
||||
Published
|
||||
Property OnExecute : TJSONRPCEvent Read FOnExecute Write FOnExecute;
|
||||
Property OnContextExecute : TJSONContextRPCEvent Read FOnContextExecute Write FOnContextExecute;
|
||||
Property BeforeExecute;
|
||||
Property AfterExecute;
|
||||
Property OnParamError;
|
||||
Property Options;
|
||||
Property ParamDefs;
|
||||
Property ResultType;
|
||||
end;
|
||||
|
||||
{ TJSONRPCEcho }
|
||||
@ -862,7 +866,9 @@ end;
|
||||
function TJSONRPCHandler.DoExecute(const Params: TJSONData;AContext : TJSONRPCCallContext): TJSONData;
|
||||
begin
|
||||
Result:=Nil;
|
||||
If Assigned(FOnExecute) then
|
||||
If Assigned(FOnContextExecute) then
|
||||
FOnContextExecute(Self,aContext,Params,Result)
|
||||
else If Assigned(FOnExecute) then
|
||||
FOnExecute(Self,Params,Result);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user