Skip to main content
Table of Contents

TTMSMCPResources.RegisterDirectResource Method

Publishes a resource at one fixed address in a single call.

API unit family: TMS.MCP.Resources Declaring type: TTMSMCPResources

Syntax

TMS.MCP.Resources.hppPascalC++
procedure RegisterDirectResource(const AName, AURI, ADescription, AMimeType: string; AResourceReader:TTMSMCPResourceMethod);
void __fastcall RegisterDirectResource(const System::UnicodeString AName, const System::UnicodeString AURI, const System::UnicodeString ADescription, const System::UnicodeString AMimeType, _di_TTMSMCPResourceMethod AResourceReader);

Remarks

The entry is built and copied into the collection, and the temporary instance is released before returning, so nothing is left for the caller to free.

Parameters

Name Description
AName Identifier the entry is listed under. Must not be empty.
AURI Fixed address clients read the entry by. Must not be empty.
ADescription Text telling a model what the entry holds and when it is worth reading. May be empty.
AMimeType Media type published as a hint for the content. May be empty.
AResourceReader Code that produces the content when the address is read. Must be assigned.

Exceptions

Exception Description
EJsonRpcException Raised with invalid-parameters, error code -32602, when the name or the address is empty or no handler is supplied.