Advanced Delphi Systems- webserver 4

Yazdığınız makaleleri ve üyelerimizin işine yarayacağını düşündüğünüz kodlarınızı gönderebilirsiniz. Bu foruma soru sormayın!
Cevapla
Kullanıcı avatarı
Asri
Kıdemli Üye
Mesajlar: 767
Kayıt: 16 Eyl 2003 09:54
Konum: istanbul

Advanced Delphi Systems- webserver 4

Mesaj gönderen Asri »

Aşağıdaki unit'i unit1'de uses olarak ekleyip bu unit içindeki procedure ve function'ları kullanbilirsiniz.

Bu unit program webserver 4 işleminde kullanılır.

Kod: Tümünü seç

unit ads_wbServ;

interface

uses
  Windows, Messages, SysUtils, Classes, HTTPApp;

type
  TWebModule1 = class(TWebModule)
    PageProducer1: TPageProducer;
    procedure WebModule1WebActionItem1Action(Sender: TObject;
      Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  WebModule1: TWebModule1;  

implementation

{$R *.DFM}

procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
   Page: TStringList;
begin
   Page := TStringList.Create;
   try
     with Page do
     begin
          Add('<HTML>');
          Add('<HEAD>');
	  Add('<TITLE>Web Server Extensions THTTPRequest Demo</TITLE>');
          Add('</HEAD>');
          Add('<BODY>');

          Add('<H3><FONT="RED">This page displays the properties of the HTTP request that asked for it.</FONT></H3>');
          Add('<P>');
          
          Add('Method = ' + Request.Method + '<BR>');
          Add('ProtocolVersion = ' + Request.ProtocolVersion + '<BR>');
          Add('URL = ' + Request.URL + '<BR>');
          Add('Query = ' + Request.Query + '<BR>');
          Add('PathInfo = ' + Request.PathInfo + '<BR>');
          Add('PathTranslated = ' + Request.PathTranslated + '<BR>');
          Add('Authorization = ' + Request.Authorization + '<BR>');
          Add('CacheControl = ' + Request.CacheControl + '<BR>');
          Add('Cookie = ' + Request.Cookie + '<BR>');
          Add('Date = ' + FormatDateTime ('mmm dd, yyyy hh:mm', Request.Date) + '<BR>');
          Add('Accept = ' + Request.Accept + '<BR>');
          Add('From = ' + Request.From + '<BR>');
          Add('Host = ' + Request.Host + '<BR>');
          Add('IfModifiedSince = ' + FormatDateTime ('mmm dd, yyyy hh:mm', Request.IfModifiedSince) + '<BR>');
          Add('Referer = ' + Request.Referer + '<BR>');
          Add('UserAgent = ' + Request.UserAgent + '<BR>');
          Add('ContentEncoding = ' + Request.ContentEncoding + '<BR>');
          Add('ContentType = ' + Request.ContentType + '<BR>');
          Add('ContentLength = ' + IntToStr(Request.ContentLength) + '<BR>');
          Add('ContentVersion = ' + Request.ContentVersion + '<BR>');
          Add('Content = ' + Request.Content + '<BR>');
          Add('Connection = ' + Request.Connection + '<BR>');
          Add('DerivedFrom = ' + Request.DerivedFrom + '<BR>');
          Add('Expires = ' + FormatDateTime ('mmm dd, yyyy hh:mm', Request.Expires) + '<BR>');
          Add('Title = ' + Request.Title + '<BR>');
          Add('RemoteAddr = ' + Request.RemoteAddr + '<BR>');
          Add('RemoteHost = ' + Request.RemoteHost + '<BR>');
          Add('ScriptName = ' + Request.ScriptName + '<BR>');
          Add('ServerPort = ' + IntToStr(Request.ServerPort) + '<BR>');
     
          Add('</BODY>');
          Add('</HTML>');
     end;
       PageProducer1.HTMLDoc := Page;
       Response.Content := PageProducer1.Content;
   finally
     Page.Free;
   end;
  Handled := True;
end;


end.
Öğrenmek ve öğretmek, akıntıya karşı yüzmek gibidir ilerleyemediğiniz taktirde gerilersiniz.
Cevapla