unigui作中间件使用


unigui作中间件使用

可返回string或者tstream数据。

如果返回JSON字符,则UNIGUI就是REST 中间件。

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
var
cmd, sql: string;
begin
cmd := ARequestInfo.URI;
if Pos('query', cmd) > 0 then
begin
sql := ARequestInfo.Params.Values['sql'];
if sql <> '' then
begin
Handled := true;
AResponseInfo.CharSet := 'UTF-8';
AResponseInfo.ContentType := 'UTF-8';
AResponseInfo.ContentText := 'unigui中间件';
end;
end;
end;

浏览器打开 URL:http://127.0.0.1:9999/query/?sql=select * from tgoods

 

 




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM