Ignore:
Timestamp:
Apr 30, 2011, 10:54:24 PM (14 years ago)
Author:
george
Message:
  • Main web server classes reworked as components for easier visual design.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Network/CoolWeb/WebServer/UHTTPServer.pas

    r104 r237  
    7777  { THTTPSessionStorage }
    7878
    79   THTTPSessionStorage = class
     79  THTTPSessionStorage = class(TComponent)
    8080    procedure Load(HandlerData: THTTPHandlerData); virtual;
    8181    procedure Save(HandlerData: THTTPHandlerData); virtual;
    82     constructor Create; virtual;
     82    constructor Create(AOwner: TComponent); override;
    8383    destructor Destroy; override;
    8484  end;
     
    8686  { THTTPServer }
    8787
    88   THTTPServer = class
     88  THTTPServer = class(TComponent)
    8989  private
     90    FDocumentRoot: string;
    9091    FOnRequest: TRequestEvent;
     92    FSessionStorage: THTTPSessionStorage;
    9193    FShowExceptions: Boolean;
    9294    procedure SetShowExceptions(const AValue: Boolean);
    9395  public
    94     Name: string;
    95     DocumentRoot: string;
    96     SessionStorage: THTTPSessionStorage;
    97     ShowExceptions: Boolean;
    9896    procedure Run; virtual;
    9997    procedure ErrorResponse(HandlerData: THTTPHandlerData);
    10098    procedure FileResponse(HandlerData: THTTPHandlerData);
    10199    procedure ServerInfo(HandlerData: THTTPHandlerData); virtual;
    102     constructor Create;
     100    constructor Create(AOwner: TComponent); override;
    103101    destructor Destroy; override;
     102  published
     103    property ShowExceptions: Boolean read FShowExceptions write SetShowExceptions;
     104    property DocumentRoot: string read FDocumentRoot write FDocumentRoot;
     105    property SessionStorage: THTTPSessionStorage read FSessionStorage
     106      write FSessionStorage;
    104107    property OnRequest: TRequestEvent read FOnRequest write FOnRequest;
    105     property ShowExceptions: Boolean read FShowExceptions write SetShowExceptions;
    106108  end;
    107109
     
    200202end;
    201203
    202 constructor THTTPServer.Create;
    203 begin
     204constructor THTTPServer.Create(AOwner: TComponent);
     205begin
     206  inherited;
    204207  ShowExceptions := False;
    205208  DocumentRoot := './';
    206   Name := 'THTTPServer';
    207209end;
    208210
    209211destructor THTTPServer.Destroy;
    210212begin
    211   SessionStorage.Free;
    212213  inherited Destroy;
    213214end;
     
    351352constructor THTTPSessionStorage.Create;
    352353begin
    353 
     354  inherited;
    354355end;
    355356
Note: See TracChangeset for help on using the changeset viewer.