ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

使用 IntraWeb (37) - TIWApplication

2021-04-29 23:57:12  阅读:210  来源: 互联网

标签:IntraWeb const string TIWApplication 37 Boolean Integer property procedure


   使用 IntraWeb (37) - TIWApplication    


每个访问用户都会拥有一个它的实例(WebApplication), 它除了承载 Session(会话)数据, 还要记忆着用户的浏览器信息、登陆信息等等; 另外, 窗体的建立也都依附(Owner)于它, 并随之自动释放.



TIWApplication 所在单元及继承链:
IWApplication.TIWApplication < TIWVCLComponent < TComponent < TPersistent < TObject

主要成员:


property AppUrlBase: string		//测试结果: /, 在 isapi 等其它模式下会有不同, 在 gSC.AllowMultipleSessionsPerUser = True 时会有不同
property InternalUrlBase: string	//测试结果: /$/
property SessionInternalUrlBase: string	//测试结果: /$/
property SessionUrlBase: string		//测试结果: /
property UserCacheUrlBase: string	//用户缓存基址, 测试结果: /$/MyApp/0pnlkje0r4hi7j19tzrq30eq0k2i/
property ApplicationURL: string		//应用地址, 测试结果: http://127.0.0.1:3126 
property CallBackProcessing: Boolean	//是否正在执行回调; only read
property CallBackResponse: TIWCallBackResponse //回调响应对象
property ApplicationPath: string  //程序路径, 测试结果: C:\Users\wy\Documents\RAD Studio\Projects\MyTest6\Win32\Debug
property ActiveForm: TComponent	  //当前窗体
property ActiveFormCount: Integer //没被销毁的窗体数
property AppID: string		  //
property AuthPassword: string	  //用户密码
property AuthUser: string	  //用户名
property Browser: TBrowser	  //浏览器
property Data: TObject		  //Session 数据
property DesignMode: Boolean	  //是否是在设计时
property ExecAction: string	  //目标地址, 默认同 FormAction
property FormAction: string	  //对应 Html Form 的 action 属性
property FormCount: Integer	  //窗体总数
property FormWidth: Integer	  //浏览器页面宽度
property FormHeight: Integer	  //浏览器页面高度
property FileList: THttpFileList  //上传文件列表
property IP: string		  //用户 IP
property IsCallBack: Boolean	  //真正处理回调
property LastAccess: TDateTime	  //最后一次会话请求的时间
property MasterTemplate: string	  //主模板地址
property ActiveMasterTemplate: string //正在使用的主模板
property SecureMode: Boolean	  //是否使用安全模式(SSL)
property ReferringURL: string	  //当前实际地址, 测试结果: http://127.0.0.1:3126/$/start
property Response: THttpReply	  //Response(相应) 对象
property Request: THttpRequest	  //Request(请求) 对象
property RunParams: TStrings	  //运行参数
property Terminated: Boolean	  //会话是否终止
property SessionTimeOut: Integer  //超时时间(分钟)
property SessionTimeStamp: TDateTime //会话开始时间
property TrackID: Cardinal	     //提交序列值(用户提交的次数)
property TaggedSessionName: string   //同 AppID?
property UserCacheDir: string	     //用户缓存路径
property MappedURL: string	     //用于获取 ExecAction
property Permissions: TIWPermissions //XII 新增的权限控制, 只有一个 CanEditPages 属性, 目的是可应用内置的 Html 编辑器, 我测试未成.
property CacheFiles: TStrings	     //缓存文件列表

property OnExecuteFormError: TExecuteFormErrorEvent //

property Forms[AIndex: Integer]: TComponent
property ActiveForms[AIndex: Integer]: TComponent

function FindFile(AName: string): THttpFile //获取上传的文件
procedure GoToURL(const AURL: string; const aPrependBaseUrl: Boolean) //转到指定地址
procedure MarkAccess //更新 LastAccess 到当前时间
class function FullApplicationURL(ARequest: THttpRequest): string //返回程序的完整地址
function FindFormByClassName(const AFormClassName: string): TComponent
function FindFormByName(const AFormName: string): TComponent
procedure SendFile(const aPathname: string; const aAttachment: Boolean; aContentType: string; aFilename: string) //aPathname: 全路径; aAttachment: True 是下载, False 在浏览器显示; aContentType: 类型, 若为空则根据扩展名判断; aFilename 重命名要下载的文件
procedure SendStream(aStream: TStream; const aAttachment: Boolean; const aContentType: string; const aFilename: string)
procedure SetActiveForm(AForm: TComponent) //一般用在 initialization 区
procedure SwitchToSecure    //转换到安全链接(支持 SSL 时)
procedure SwitchToNonSecure //转换到非安全链接(支持 SSL 时)
procedure ShowMessage(AMsg: string; const AType: TIWShowMessageType; ATemplate: string) //AMsg: 信息; AType: smAlert, smNewWindow, smSameWindow, smSameWindowFrame; Atemplate: 模板(后两个 Type 时), 默认 IWShowMessage.html
procedure NewWindow(const AURL: string)	//Open Window, 通过下面重载可设置更多参数
procedure NewWindow(const AURL: string; const AName: string; const AWidth: Integer; const AHeight: Integer)
procedure NewWindow(const AURL: string; const AName: string; const AWidth: Integer; const AHeight: Integer; AOptions: TIWWindowOptions; const ATop: Integer; const ALeft: Integer)
procedure Terminate //终止应用
procedure Terminate(const AMsg: string)	//终止并提示信息
procedure TerminateAndRedirect(const aURL: string) //终止并转到
procedure RegisterCallBack(AName: string; ACallbackFunction: TIWCallbackFunction = procedure(aParams: TStringList) of object) //注册函数, 会替换同名
procedure PerformCallBack(Sender: TComponent; const AName: string) //执行 RegisterCallBack 注册的函数
function GetInternalFileURL(const AFilename: string): string //获取内部文件链接, 如: WebApplication.GetInternalFileURL('js/IWBase.js')
function GetExternalFileURL(const AFilename: string): string //获取外部文件(wwwroot 或自定义的文件夹)链接
procedure Lock	 //锁; 以防止并发访问
procedure Unlock //解锁
function TryLock: Boolean //尝试锁(会让其他线程等待); 成功返回 True


示例 1:



//待续...


示例 2:



//待续...



标签:IntraWeb,const,string,TIWApplication,37,Boolean,Integer,property,procedure
来源: https://blog.51cto.com/u_14617575/2744232

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有