版本10 seattle

新建intraWeb

new->other->Delphi Projecs->IntraWeb->IntraWeb Application wizard

建立测试工程时, 一般要使用 StandAlone Application, 这方便调试; 具体发布时只需稍稍修改.

自动生成,以下几个文件

Project1

program Project1;

uses
Vcl.Forms,  ---这里本来是生成是Forms,     //报错,看了万一的博客说了这句“   还是以前的那个 Forms, 现在叫 Vcl.Forms 了 ”,改了不报错

IWStart,
UTF8ContentParser,
Unit1 in 'Unit1.pas' {IWForm1: TIWAppForm},
ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},  //这才是 IntraWeb 工程的核心单元, 每个工程都会在该单元自动建立一个(只有一个)                                           Server Controller 对象, 这个对象统管所有(包括 Session)

UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};   //该单元主要维护一个 Session 数据对象, 并提供给 ServerController 使用

{$R *.res}

begin
TIWStart.Execute(True);
end.

//这里的代码是自动维护的; 只有在修改发布模式时, 才会来这里做简单的修改(譬如把 program Project1 改为 library Project1 

UserSessionUnit;

unit UserSessionUnit;

{
This is a DataModule where you can add components or declare fields that are specific to
ONE user. Instead of creating global variables, it is better to use this datamodule. You can then
access the it using UserSession.
}

{注释}
//该单元目前只有一个空的 TIWUserSession, 但也已被 ServerController 单元 uses 并使用
//不同的网站程序对用户信息的需求可能不一样(譬如: 登陆信息、购物车信息等等), 我们可以在这里定义需要的数据格式; 因为灵活性很大, 所以关于 Session 的方便操作也是 IW 在宣传时首先要吹嘘的
//在它的窗体上可以放置非可视控件
//TIWUserSessionBase 的父类是我们熟悉的 TDataModule, 所以我说这是 Session 相关的数据模块.

interface

uses
IWUserSessionBase, SysUtils, Classes;

type
TIWUserSession = class(TIWUserSessionBase)
private
{ Private declarations }
public
{ Public declarations }
end;

implementation

{$R *.dfm}

end.

ServerController;

unit ServerController;

interface

uses
SysUtils, Classes, IWServerControllerBase, IWBaseForm, HTTPApp,
// For OnNewSession Event
UserSessionUnit, IWApplication, IWAppForm;

type
TIWServerController = class(TIWServerControllerBase)
procedure IWServerControllerBaseNewSession(ASession: TIWApplication);

private

public
end;

function UserSession: TIWUserSession;
function IWServerController: TIWServerController;

implementation

{$R *.dfm}

uses
IWInit, IWGlobal;

function IWServerController: TIWServerController;
begin
Result := TIWServerController(GServerController);
end;

function UserSession: TIWUserSession;
begin
Result := TIWUserSession(WebApplication.Data);
end;

procedure TIWServerController.IWServerControllerBaseNewSession(
ASession: TIWApplication);
begin
ASession.Data := TIWUserSession.Create(nil);
end;

initialization
TIWServerController.SetServerControllerClass;

end.

最新文章

  1. 切图时图片的选择:JPG、PNG、GIF的区别
  2. 获取当前3Ds MAX版本
  3. Codeforces Round #381 (Div. 2) 复习倍增//
  4. instanceof, typeof, & Object.prototype.toString
  5. spark spark ziliao important
  6. redirect模块的秘密
  7. hadoop错误org.apache.hadoop.util.DiskChecker$DiskErrorException Could not find any valid local directory for
  8. STL——临时对象的产生与运用
  9. 百度地图LBS云平台读写数据操作类
  10. 扒一扒ReentrantLock以及AQS实现原理
  11. 剑指offer-面试题.二叉树的镜像
  12. 实用Shell命令备忘
  13. 有关信息ACM/ICPC竞争环境GCC/G++叠插件研究记录的扩展
  14. ARM处理器寄存器
  15. MyBatis之级联小结
  16. Tornado 网站demo 一
  17. spring :Log4j各级别日志重复打印
  18. c语言的重构、清理与代码分析图形化浏览工具: CScout
  19. 网络通信协议七之ARP工作过程及工作原理解析
  20. Linux 下安装JDK和jmeter 及环境配置记录过程

热门文章

  1. C语言 fork
  2. c语言中数组名和指针变量的区别
  3. 矩阵乘法C语言实现
  4. [svc]salt-webui
  5. Windows管理多个java版本--解决'has value '1.8',but'1.7' is required'的方法
  6. Ubuntu 14.04 下FTP服务器的搭建
  7. linux学习笔记29---命令watch
  8. SAML2.0 协议初识(三)——IDP
  9. Activiti(一)--安装配置具体解释
  10. yii2 RESTful API 405 Method Not Allowed