TsgcWebSocketHTTPServer属性 › DocumentRoot

DocumentRoot 属性

内置 HTTP 服务器用于提供静态文件(HTML、JavaScript、CSS、图像等)的目录。

语法

property DocumentRoot: String read GetDocumentRoot write FDocumentRoot;

默认值

(空字符串)

备注

DocumentRoot 设置为包含 HTTP 服务器允许分发的静态资产的本地文件夹。当客户端请求文档路径时,服务器将 DocumentRoot 与请求 URI 拼接,如果生成的文件存在,则直接返回而不触发 OnCommandGet 事件。将属性留空以禁用自动文件分发,使每个请求都以编程方式处理。尾部的斜杠或反斜杠将被自动去除。

示例


oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.Port := 80;
oServer.DocumentRoot := 'c:\www';
oServer.Active := true;

返回属性