home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Runimage / Delphi50 / Source / Rtl / Win / ASPTLB.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  13.8 KB  |  331 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Borland Delphi Visual Component Library         }
  4. {                                                       }
  5. {       Copyright (c) 1995,99 Inprise Corporation       }
  6. {                                                       }
  7. {*******************************************************}
  8.  
  9. unit Asptlb;
  10.  
  11. interface
  12.  
  13. uses
  14.   ActiveX, ComObj, Mtx;
  15.  
  16. type
  17.   IStringList = interface(IDispatch)
  18.     ['{D97A6DA0-A85D-11CF-83AE-00A0C90C2BD8}']
  19.     function Get_Item(i: OleVariant): OleVariant; safecall;
  20.     function Get_Count: SYSINT; safecall;
  21.     function Get__NewEnum: IUnknown; safecall;
  22.     property Item[i: OleVariant]: OleVariant read Get_Item; default;
  23.     property Count: SYSINT read Get_Count;
  24.     property _NewEnum: IUnknown read Get__NewEnum;
  25.   end;
  26.   {$EXTERNALSYM IStringList}
  27.  
  28.   IRequestDictionary = interface(IDispatch)
  29.     ['{D97A6DA0-A85F-11DF-83AE-00A0C90C2BD8}']
  30.     function Get_Item(Var_: OleVariant): OleVariant; safecall;
  31.     function Get__NewEnum: IUnknown; safecall;
  32.     function Get_Count: SYSINT; safecall;
  33.     function Get_Key(VarKey: OleVariant): OleVariant; safecall;
  34.     property Item[Var_: OleVariant]: OleVariant read Get_Item; default;
  35.     property _NewEnum: IUnknown read Get__NewEnum;
  36.     property Count: SYSINT read Get_Count;
  37.     property Key[VarKey: OleVariant]: OleVariant read Get_Key;
  38.   end;
  39.   {$EXTERNALSYM IRequestDictionary}
  40.  
  41.   IRequest = interface(IDispatch)
  42.     ['{D97A6DA0-A861-11CF-93AE-00A0C90C2BD8}']
  43.     function Get_Item(const bstrVar: WideString): IDispatch; safecall;
  44.     function Get_QueryString: IRequestDictionary; safecall;
  45.     function Get_Form: IRequestDictionary; safecall;
  46.     function Get_Body: IRequestDictionary; safecall;
  47.     function Get_ServerVariables: IRequestDictionary; safecall;
  48.     function Get_ClientCertificate: IRequestDictionary; safecall;
  49.     function Get_Cookies: IRequestDictionary; safecall;
  50.     function Get_TotalBytes: Integer; safecall;
  51.     function BinaryRead(var pvarCountToRead: OleVariant): OleVariant; safecall;
  52.     property Item[const bstrVar: WideString]: IDispatch read Get_Item; default;
  53.     property QueryString: IRequestDictionary read Get_QueryString;
  54.     property Form: IRequestDictionary read Get_Form;
  55.     property Body: IRequestDictionary read Get_Body;
  56.     property ServerVariables: IRequestDictionary read Get_ServerVariables;
  57.     property ClientCertificate: IRequestDictionary read Get_ClientCertificate;
  58.     property Cookies: IRequestDictionary read Get_Cookies;
  59.     property TotalBytes: Integer read Get_TotalBytes;
  60.   end;
  61.   {$EXTERNALSYM IRequest}
  62.  
  63.   IReadCookie = interface(IDispatch)
  64.     ['{71EAF260-0CE0-11D0-A53E-00A0C90C2091}']
  65.     function Get_Item(Var_: OleVariant): OleVariant; safecall;
  66.     function Get_HasKeys: WordBool; safecall;
  67.     function Get__NewEnum: IUnknown; safecall;
  68.     function Get_Count: SYSINT; safecall;
  69.     function Get_Key(VarKey: OleVariant): OleVariant; safecall;
  70.     property Item[Var_: OleVariant]: OleVariant read Get_Item; default;
  71.     property HasKeys: WordBool read Get_HasKeys;
  72.     property _NewEnum: IUnknown read Get__NewEnum;
  73.     property Count: SYSINT read Get_Count;
  74.     property Key[VarKey: OleVariant]: OleVariant read Get_Key;
  75.   end;
  76.   {$EXTERNALSYM IReadCookie}
  77.  
  78.   IWriteCookie = interface(IDispatch)
  79.     ['{D97A6DA0-A862-11CF-84AE-00A0C90C2BD8}']
  80.     procedure Set_Item(Key: OleVariant; const Param2: WideString); safecall;
  81.     procedure Set_Expires(Param1: TDateTime); safecall;
  82.     procedure Set_Domain(const Param1: WideString); safecall;
  83.     procedure Set_Path(const Param1: WideString); safecall;
  84.     procedure Set_Secure(Param1: WordBool); safecall;
  85.     function Get_HasKeys: WordBool; safecall;
  86.     function Get__NewEnum: IUnknown; safecall;
  87.     property Item[Key: OleVariant]: WideString write Set_Item; default;
  88.     property Expires: TDateTime write Set_Expires;
  89.     property Domain: WideString write Set_Domain;
  90.     property Path: WideString write Set_Path;
  91.     property Secure: WordBool write Set_Secure;
  92.     property HasKeys: WordBool read Get_HasKeys;
  93.     property _NewEnum: IUnknown read Get__NewEnum;
  94.   end;
  95.   {$EXTERNALSYM IWriteCookie}
  96.  
  97.   IResponse = interface(IDispatch)
  98.     ['{D97A6DA0-A864-11CF-83BE-00A0C90C2BD8}']
  99.     function Get_Buffer: WordBool; safecall;
  100.     procedure Set_Buffer(fIsBuffering: WordBool); safecall;
  101.     function Get_ContentType: WideString; safecall;
  102.     procedure Set_ContentType(const pbstrContentTypeRet: WideString); safecall;
  103.     function Get_Expires: OleVariant; safecall;
  104.     procedure Set_Expires(pvarExpiresMinutesRet: Integer); safecall;
  105.     function Get_ExpiresAbsolute: OleVariant; safecall;
  106.     procedure Set_ExpiresAbsolute(pvarExpiresRet: TDateTime); safecall;
  107.     function Get_Cookies: IRequestDictionary; safecall;
  108.     function Get_Status: WideString; safecall;
  109.     procedure Set_Status(const pbstrStatusRet: WideString); safecall;
  110.     procedure Add(const bstrHeaderValue: WideString; const bstrHeaderName: WideString); safecall;
  111.     procedure AddHeader(const bstrHeaderName: WideString; const bstrHeaderValue: WideString); safecall;
  112.     procedure AppendToLog(const bstrLogEntry: WideString); safecall;
  113.     procedure BinaryWrite(varInput: OleVariant); safecall;
  114.     procedure Clear; safecall;
  115.     procedure End_; safecall;
  116.     procedure Flush; safecall;
  117.     procedure Redirect(const bstrURL: WideString); safecall;
  118.     procedure Write(varText: OleVariant); safecall;
  119.     procedure WriteBlock(iBlockNumber: Smallint); safecall;
  120.     function IsClientConnected: WordBool; safecall;
  121.     function Get_CharSet: WideString; safecall;
  122.     procedure Set_CharSet(const pbstrCharSetRet: WideString); safecall;
  123.     procedure Pics(const bstrHeaderValue: WideString); safecall;
  124.     function Get_CacheControl: WideString; safecall;
  125.     procedure Set_CacheControl(const pbstrCacheControl: WideString); safecall;
  126.     property Buffer: WordBool read Get_Buffer write Set_Buffer;
  127.     property ContentType: WideString read Get_ContentType write Set_ContentType;
  128.     property Cookies: IRequestDictionary read Get_Cookies;
  129.     property Status: WideString read Get_Status write Set_Status;
  130.     property CharSet: WideString read Get_CharSet write Set_CharSet;
  131.     property CacheControl: WideString read Get_CacheControl write Set_CacheControl;
  132.   end;
  133.   {$EXTERNALSYM IResponse}
  134.  
  135.   IVariantDictionary = interface(IDispatch)
  136.     ['{4A7DEB90-B069-11D0-B373-00A0C90C2BD8}']
  137.     function Get_Item(VarKey: OleVariant): OleVariant; safecall;
  138.     procedure _Set_Item(VarKey: OleVariant; pvar: OleVariant); safecall;
  139.     procedure Set_Item(VarKey: OleVariant; pvar: OleVariant); safecall;
  140.     function Get_Key(VarKey: OleVariant): OleVariant; safecall;
  141.     function Get_Count: SYSINT; safecall;
  142.     function Get__NewEnum: IUnknown; safecall;
  143.     property Item[VarKey: OleVariant]: OleVariant read Get_Item write _Set_Item; default;
  144.     property Key[VarKey: OleVariant]: OleVariant read Get_Key;
  145.     property Count: SYSINT read Get_Count;
  146.     property _NewEnum: IUnknown read Get__NewEnum;
  147.   end;
  148.   {$EXTERNALSYM IVariantDictionary}
  149.  
  150.   ISessionObject = interface(IDispatch)
  151.     ['{D97A6DA0-A865-11CF-83AF-00A0C90C2BD8}']
  152.     function Get_SessionID: WideString; safecall;
  153.     function Get_Value(const bstrValue: WideString): OleVariant; safecall;
  154.     procedure _Set_Value(const bstrValue: WideString; pvar: OleVariant); safecall;
  155.     procedure Set_Value(const bstrValue: WideString; pvar: OleVariant); safecall;
  156.     function Get_Timeout: Integer; safecall;
  157.     procedure Set_Timeout(plvar: Integer); safecall;
  158.     procedure Abandon; safecall;
  159.     function Get_CodePage: Integer; safecall;
  160.     procedure Set_CodePage(plvar: Integer); safecall;
  161.     function Get_LCID: Integer; safecall;
  162.     procedure Set_LCID(plvar: Integer); safecall;
  163.     function Get_StaticObjects: IVariantDictionary; safecall;
  164.     function Get_Contents: IVariantDictionary; safecall;
  165.     property SessionID: WideString read Get_SessionID;
  166.     property Value[const bstrValue: WideString]: OleVariant read Get_Value write _Set_Value; default;
  167.     property Timeout: Integer read Get_Timeout write Set_Timeout;
  168.     property CodePage: Integer read Get_CodePage write Set_CodePage;
  169.     property LCID: Integer read Get_LCID write Set_LCID;
  170.     property StaticObjects: IVariantDictionary read Get_StaticObjects;
  171.     property Contents: IVariantDictionary read Get_Contents;
  172.   end;
  173.   {$EXTERNALSYM ISessionObject}
  174.  
  175.   IApplicationObject = interface(IDispatch)
  176.     ['{D97A6DA0-A866-11CF-83AE-10A0C90C2BD8}']
  177.     function Get_Value(const bstrValue: WideString): OleVariant; safecall;
  178.     procedure _Set_Value(const bstrValue: WideString; pvar: OleVariant); safecall;
  179.     procedure Set_Value(const bstrValue: WideString; pvar: OleVariant); safecall;
  180.     procedure Lock; safecall;
  181.     procedure UnLock; safecall;
  182.     function Get_StaticObjects: IVariantDictionary; safecall;
  183.     function Get_Contents: IVariantDictionary; safecall;
  184.     property Value[const bstrValue: WideString]: OleVariant read Get_Value write _Set_Value; default;
  185.     property StaticObjects: IVariantDictionary read Get_StaticObjects;
  186.     property Contents: IVariantDictionary read Get_Contents;
  187.   end;
  188.   {$EXTERNALSYM IApplicationObject}
  189.  
  190.   IServer = interface(IDispatch)
  191.     ['{D97A6DA0-A867-11CF-83AE-01A0C90C2BD8}']
  192.     function Get_ScriptTimeout: Integer; safecall;
  193.     procedure Set_ScriptTimeout(plTimeoutSeconds: Integer); safecall;
  194.     function CreateObject(const bstrProgID: WideString): IDispatch; safecall;
  195.     function HTMLEncode(const bstrIn: WideString): WideString; safecall;
  196.     function MapPath(const bstrLogicalPath: WideString): WideString; safecall;
  197.     function URLEncode(const bstrIn: WideString): WideString; safecall;
  198.     function URLPathEncode(const bstrIn: WideString): WideString; safecall;
  199.     property ScriptTimeout: Integer read Get_ScriptTimeout write Set_ScriptTimeout;
  200.   end;
  201.   {$EXTERNALSYM IServer}
  202.  
  203.   IScriptingContext = interface(IDispatch)
  204.     ['{D97A6DA0-A868-11CF-83AE-00B0C90C2BD8}']
  205.     function Get_Request: IRequest; safecall;
  206.     function Get_Response: IResponse; safecall;
  207.     function Get_Server: IServer; safecall;
  208.     function Get_Session: ISessionObject; safecall;
  209.     function Get_Application_: IApplicationObject; safecall;
  210.     property Request: IRequest read Get_Request;
  211.     property Response: IResponse read Get_Response;
  212.     property Server: IServer read Get_Server;
  213.     property Session: ISessionObject read Get_Session;
  214.     property Application_: IApplicationObject read Get_Application_;
  215.   end;
  216.   {$EXTERNALSYM IScriptingContext}
  217.  
  218.   IASPObject = interface
  219.   ['{7A8B9910-F33C-11D2-9EDD-00C04F6539EE}']
  220.     procedure OnStartPage(AScriptingContext: IUnknown); safecall;
  221.     procedure OnEndPage; safecall;
  222.   end;
  223.  
  224.   TASPObject = class(TAutoObject, IASPObject)
  225.   private
  226.     FScriptingContext: IScriptingContext;
  227.     function GetApplication: IApplicationObject;
  228.     function GetRequest: IRequest;
  229.     function GetResponse: IResponse;
  230.     function GetScriptingContext: IScriptingContext;
  231.     function GetServer: IServer;
  232.     function GetSession: ISessionObject;
  233.   public
  234.     procedure OnStartPage(AScriptingContext: IUnknown); safecall;
  235.     procedure OnEndPage; safecall;
  236.     property ScriptingContext: IScriptingContext read GetScriptingContext;
  237.     property Request: IRequest read GetRequest;
  238.     property Response: IResponse read GetResponse;
  239.     property Session: ISessionObject read GetSession;
  240.     property Server: IServer read GetServer;
  241.     property Application: IApplicationObject read GetApplication;
  242.   end;
  243.  
  244.   TASPMTSObject = class(TAutoObject)
  245.   private
  246.     function GetApplication: IApplicationObject;
  247.     function GetRequest: IRequest;
  248.     function GetResponse: IResponse;
  249.     function GetServer: IServer;
  250.     function GetSession: ISessionObject;
  251.   public
  252.     property Request: IRequest read GetRequest;
  253.     property Response: IResponse read GetResponse;
  254.     property Session: ISessionObject read GetSession;
  255.     property Server: IServer read GetServer;
  256.     property Application: IApplicationObject read GetApplication;
  257.   end;
  258.  
  259. implementation
  260.  
  261. { TASPObject }
  262.  
  263. function TASPObject.GetApplication: IApplicationObject;
  264. begin
  265.   Result := FScriptingContext.Application_;
  266. end;
  267.  
  268. function TASPObject.GetRequest: IRequest;
  269. begin
  270.   Result := FScriptingContext.Request;
  271. end;
  272.  
  273. function TASPObject.GetResponse: IResponse;
  274. begin
  275.   Result := FScriptingContext.Response;
  276. end;
  277.  
  278. function TASPObject.GetScriptingContext: IScriptingContext;
  279. begin
  280.   Result := FScriptingContext;
  281. end;
  282.  
  283. function TASPObject.GetServer: IServer;
  284. begin
  285.   Result := FScriptingContext.Server;
  286. end;
  287.  
  288. function TASPObject.GetSession: ISessionObject;
  289. begin
  290.   Result := FScriptingContext.Session;
  291. end;
  292.  
  293. procedure TASPObject.OnEndPage;
  294. begin
  295.   FScriptingContext := nil;
  296. end;
  297.  
  298. procedure TASPObject.OnStartPage(AScriptingContext: IUnknown);
  299. begin
  300.   FScriptingContext := (AScriptingContext as IScriptingContext);
  301. end;
  302.  
  303. { TASPMTSObject }
  304.  
  305. function TASPMTSObject.GetApplication: IApplicationObject;
  306. begin
  307.   Result := IUnknown((GetObjectContext as IGetContextProperties).GetProperty('Application')) as IApplicationObject;
  308. end;
  309.  
  310. function TASPMTSObject.GetRequest: IRequest;
  311. begin
  312.   Result := IUnknown((GetObjectContext as IGetContextProperties).GetProperty('Request')) as IRequest;
  313. end;
  314.  
  315. function TASPMTSObject.GetResponse: IResponse;
  316. begin
  317.   Result := IUnknown((GetObjectContext as IGetContextProperties).GetProperty('Response')) as IResponse;
  318. end;
  319.  
  320. function TASPMTSObject.GetServer: IServer;
  321. begin
  322.   Result := IUnknown((GetObjectContext as IGetContextProperties).GetProperty('Server')) as IServer;
  323. end;
  324.  
  325. function TASPMTSObject.GetSession: ISessionObject;
  326. begin
  327.   Result := IUnknown((GetObjectContext as IGetContextProperties).GetProperty('Session')) as ISessionObject;
  328. end;
  329.  
  330. end.
  331.