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


TIWApplication 所在单元及继承链:
IWApplication.TIWApplication

主要成员:


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 (37) - TIWApplication的更多相关文章

  1. mahout安装和测试

    Mahout 是 Apache Software Foundation(ASF) 旗下的一个开源项目,提供一些可扩展的机器学习领域经典算法的实现,旨在帮助开发者更加方便快捷地创建智能应用程序.Apac ...

  2. 使用delphi+intraweb进行微信开发1--微信平台接入

    示例代码已经放出!请移步使用delphi+intraweb进行微信开发1~4代码示例进行下载,虽为示例代码但是是从我项目中移出来的,封装很完备适于自行扩展和修改. iw14.0.50来了,在新的版本中 ...

  3. 使用 IntraWeb (39) - THttpRequest、THttpReply

    在其它服务器脚本语言中熟悉的 Request.Response(THttpRequest.THttpReply) 在 IntraWeb 中算是幕后英雄了, 用户基本不需要直接操作它们了. IW 默认 ...

  4. 使用 IntraWeb (32) - Url 映射与 THandlers

    最简单的 Url 映射是使用 TIWAppForm 的 class 方法: SetURL; THandlers 是 IntraWeb XIV 新增的内容处理器, 它能完成的不仅仅是 Url 映射(转发 ...

  5. 使用 IntraWeb (3) - 页面切换

    新建 StandAlone Application 工程后, 再通过 File > New > Other.. > IntraWeb > New Form 添加两个窗体. 然后 ...

  6. 使用 IntraWeb (2) - Hello IntraWeb

    IntraWeb 比我相像中的更贴近 VCL, 传统的非可视组件在这里大都可用(其内部很多复合属性是 TStringList 类型的), 它的诸多可视控件也是从 TControl 继承下来的. 这或许 ...

  7. CSharpGL(37)创建和使用VBO的最佳方式

    CSharpGL(37)创建和使用VBO的最佳方式 开始 近日在OpenGL红宝书上看到这样的讲解. 其核心意思是,在创建VBO时用 glBufferData(GL_ARRAY_BUFFER, len ...

  8. C#开发微信门户及应用(37)--微信公众号标签管理功能

    微信公众号,仿照企业号的思路,增加了标签管理的功能,对关注的粉丝可以设置标签管理,实现更加方便的分组管理功能.开发者可以使用用户标签管理的相关接口,实现对公众号的标签进行创建.查询.修改.删除等操作, ...

  9. 背水一战 Windows 10 (37) - 控件(弹出类): MessageDialog, ContentDialog

    [源码下载] 背水一战 Windows 10 (37) - 控件(弹出类): MessageDialog, ContentDialog 作者:webabcd 介绍背水一战 Windows 10 之 控 ...

随机推荐

  1. Android通讯:通话

    Android通讯之通话功能的实现: 在Android中,android.telephony.TelephonyManager对象是开发者获取当前通话网络相关信息的窗口,通过TelephonyMana ...

  2. Expm 2_2 查找中项问题

    对于长度为n的整型数组A,随机生成其数组元素值,然后实现一个线性时间的算法,在该数组中查找其中项. package org.xiu68.exp.exp3; import java.util.Array ...

  3. javascript判断是用什么设备打开

    var userAgentInfo = navigator.userAgent //查看浏览器用于 HTTP 请求的用户代理头的值 var agents = ["Android", ...

  4. vue2进阶之v-model在组件上的使用

    v-model 用在 input 元素上时 v-model虽然很像使用了双向数据绑定的 Angular 的 ng-model,但是 Vue 是单项数据流,v-model 只是语法糖而已: <in ...

  5. MySQL CPU 使用率高的原因和解决方法

    用户在使用 MySQL 实例时,会遇到 CPU 使用率过高甚至达到 100% 的情况.本文将介绍造成该状况的常见原因以及解决方法,并通过 CPU 使用率为 100% 的典型场景,来分析引起该状况的原因 ...

  6. 如何将Request对象中的参数列表打印出来

    Map<String, String[]> map = request.getParameterMap(); Set<Map.Entry<String, String[]> ...

  7. Memcache简单使用

    1:Memcache的下载https://pan.baidu.com/s/1dFnB3NV/08中 简单安装:直接点击文件夹中的memcached.exe文件即可.但是每次使用都需要双击,比较麻烦.所 ...

  8. HTML5布局

    完整示例 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  9. oracle查询出来的时间吸附为每5min

    to_char(PACKET_TIME,'yyyy-mm-dd hh24:')||floor(to_char(PACKET_TIME,'mi')/5 )*5||':00' as start_time, ...

  10. webpack - require 概要

    webpack 是一个预编译模块打包工具,它只会对使用到的模块进行打包. 一个模块是否被使用?可以根据该模块是否被 require 来判断.如果require时指定的是具体的模块名称与正确的路径,那么 ...