fpc/packages/fcl-net/examples/svrclass_xmlrpc.pp
peter 00dabb1265 * move uriparser to fcl-base
* move netdb unit and examples to fcl-net
  * removed netdb package

git-svn-id: trunk@9909 -
2008-01-24 23:30:20 +00:00

41 lines
949 B
ObjectPascal

unit svrclass_XMLRPC;
interface
uses Classes, XMLRPC, svrclass;
type
TServerClassXMLRPCServlet = class(TXMLRPCServlet)
private
FServerClass: TServerClass;
protected
procedure Dispatch(AParser: TXMLRPCParser; AWriter: TXMLRPCWriter; APath: TStrings); override;
published
property ServerClass: TServerClass read FServerClass write FServerClass;
end;
implementation
procedure TServerClassXMLRPCServlet.Dispatch(AParser: TXMLRPCParser; AWriter: TXMLRPCWriter; APath: TStrings);
var
s: String;
begin
s := APath[0];
if s = 'WRITESTRING' then
begin
AParser.ResetValueCursor;
ServerClass.WriteString(AParser.GetPrevString);
AWriter.WriteResponse(nil);
end else if s = 'ADD' then
begin
AParser.ResetValueCursor;
AWriter.WriteResponse(AWriter.CreateIntValue(ServerClass.Add(AParser.GetPrevInt, AParser.GetPrevInt)));
end else
AWriter.WriteFaultResponse(2, 'Invalid method name');
end;
end.