This is a web server component that can be pretty much fully customised by a
set of Python scripts.
These events are available via Python event handlers:
- GET(Requester,URL,Header,Body)
- GETCompleted(Requester,URL,Code)
- PUT(Requester,URL,Header,Body)
- PUTCompleted(Requester,URL,Code)
- DELETE(Requester,URL,Header,Body)
- DELETECompleted(Requester,URL,Code)
- HEAD(Requester,URL,Header,Body)
- HEADCompleted(Requester,URL,Code)
- POST(Id,Requester,URL,Header,Body)
These event handlers are very special indeed. All apart from the “--Completed”
ones also return values to the web server, controlling the responses to
requests. When you generate event handlers, you will be given comments to
get you going. For Details, see How to
program, here is just a summary of your options:
- The GET handler can accept or deny the transaction, or compose the
return value itself (either as text or as a file)
- The PUT, DELETE and HEAD handlers can accept or deny the transaction
- The POST handler must be implemented for any POST calls to be
accepted. The script is responsible for handling this, either synchronously
or asynchronously.
The WebServer configuration is accessed in Service mode under
Service - Advanced - Web Server. The event handlers are edited and available
under Service - Advanced - Central.
Only one function is available to the WebServer via the TDVCmdProtocol
interface (details here):
- WebServer.AsyncPostResponse;ID=<id>;ContentType=<type>;ExHeaderLines=<lines>;Body=<body>;Code=<code>
To call this function from a Python script, you use the abbreviated form,
WebServer.AsyncPostResponse(<id>,<type>,<exheaderlines>,<body>,<code>)
This is a belated reply to a POST event, needed if the POST handler
specifies asynchroneous reply.
|