Class TServerObject (unit RBroker) |
TObject
:TServerObject is the ancestor (abstract class) for all object responsible for doing the application server work. The ORB create instances of server object, pass client request to them and call their Execute method. When the server object work is done, it must call the Finish method to send the response back to the client. This can be done either from the execute method or form any other point later in time.
Constructors |
Functions |
Properties |
Events |
Variables |
Constructors |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
:This constructor is used by the ORB just to get the function code. Normally not used outside of the ORB code.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This is just a partial object creation, just enough to get the function } { code created. } { The function code is build from the class name, removing the base class } { name. This behaviour can be overriden in the descendent classes.
Functions |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
:The ORB (Object Request Broker, TRequestBroker component) call this method to make the server object do his work: execute the request and produce a response. You MUST override this method and place the effective code for the server object work.
:The server object MUST call this method to signal the ORB (Object Request Broker, TRequestBroker component) that the server's object work is done and the response is ready to be sent to the client. You can call Finish just before returning from the Execute method, or at some later moment if the server object continue processing in the background after the Execute method has returned control back to the ORB (this means you have written an event driven server object or a multi-threaded server object). While Execute method code runs, no other client is serviced. If the processing is long, you probably wants to start a thread to do the processing in the background and call Finish method at a later time, or wants to write a fully event-driven server object which works by sending messages.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
:The ORB (Object Request Broker, TRequestBroker component) call this method to pass a request from the client to the server object.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
:The ORB (Object Request Broker, TRequestBroker component) call this method when the server object must be initialized. This is done only ONCE per server run. This procedure can be overriden to place any code needed to initialize global data for the server object.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
:BuildFunctionCode will initialize FFunctionCode with the function code handled by the ServerObject. Default to the class name without TServerObject.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { Build the function code. The code is based on the classname. For example } { TServerObjectTest will have function code equal to 'TEST' } { If the classname do not begin by TServerObject, the function code will be } { the class name without any leading 'T': TMyObject will gives 'MYOBJECT'. } { This behaviour can be overriden in descendent objects to fit particular } { needs.
:Triggers the OnDisplay event, if assigned.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Properties |
Events |
Variables |
:The FunctionCode is used by the ORB to know how to dispatch client requests to the various server object he has in his table. By default the FunctionCode is derived from the server object class name and is the class name without the leading TServerObject. You can overrdie the BuilFunctionCode method to change that behaviour. The function code is case incensitive.
:To be used for persistent data.
:Data received from the ORB.
:Where the request comes in.
:Where the result goes to.
:The default response size.
:ResultStatus returned to client. Based on the model used by the HTTP protocol: 200 means OK, 400 means error. See HTTP protocol reference. The server does'nt really use this ResultStatus. It's used by the client. The ResultStatus value is returned in the client's TAppSrvClient AnswerStatus property as a string.
:Reserved for the TServerObject descendent writer. It is generally used to pass global data from the application server to the various server object. For example TTable or any other global data. Using FUserData is far better way of programming than using global variables.