使用 IntraWeb (37) - TIWApplication

來源:互聯網
上載者:User

標籤:des   class   http   tar   ext   com   


每個訪問使用者都會擁有一個它的執行個體(WebApplication), 它除了承載 Session(會話)資料, 還要記憶著使用者的瀏覽器資訊、登陸資訊等等; 另外, 表單的建立也都依附(Owner)於它, 並隨之自動釋放.
TIWApplication 所在單元及繼承鏈:
IWApplication.TIWApplication < TIWVCLComponent < TComponent < TPersistent < TObject

主要成員:
property AppUrlBase: string//測試結果: /, 在 isapi 等其它模式下會有不同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 readproperty CallBackResponse: TIWCallBackResponse //回調響應對象property ApplicationPath: string  //程式路徑, 測試結果: C:\Users\wy\Documents\RAD Studio\Projects\MyTest6\Win32\Debugproperty 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  //目標地址, 預設同 FormActionproperty FormAction: string  //對應 Html Form 的 action 屬性property FormCount: Integer  //表單總數property FormWidth: Integer  //瀏覽器頁面寬度property FormHeight: Integer  //瀏覽器頁面高度property FileList: THttpFileList  //上傳檔案清單property IP: string  //使用者 IPproperty IsCallBack: Boolean  //真正處理回調property LastAccess: TDateTime  //最後一次會話請求的時間property MasterTemplate: string  //主模板地址property ActiveMasterTemplate: string //正在使用的主模板property SecureMode: Boolean  //是否使用安全模式(SSL)property ReferringURL: string  //當前實際地址, 測試結果: http://127.0.0.1:3126/$/startproperty 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     //用於擷取 ExecActionproperty Permissions: TIWPermissions //XII 新增的許可權控制, 只有一個 CanEditPages 屬性, 目的是可應用內建的 Html 編輯器, 我測試未成.property CacheFiles: TStrings     //快取檔案列表property OnExecuteFormError: TExecuteFormErrorEvent //property Forms[AIndex: Integer]: TComponentproperty ActiveForms[AIndex: Integer]: TComponentfunction 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): TComponentfunction FindFormByName(const AFormName: string): TComponentprocedure 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.htmlprocedure 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:
//待續...

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.