Ignore:
Timestamp:
Dec 17, 2009, 8:25:15 AM (15 years ago)
Author:
george
Message:
  • Přidáno: Zobrazení ServerInfo.
  • Přidáno: Zpracování HTTP Cookies.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DirectWeb/UWebServer.pas

    r85 r86  
    2323    function PagesList(URL: string; Page, TotalCount, CountPerPage: Integer
    2424      ): string;
     25    procedure ServerInfo(Request: THTTPRequest; Response: THTTPResponse);
    2526  public
    2627    HTTPServer: THTTPServer;
     
    144145  OrderDirection: string;
    145146  Title: string;
    146   LinkQuery: TQueryString;
     147  LinkQuery: TQueryParameterList;
    147148begin
    148149  SqlDatabase := TSqlDatabase.Create;
     
    165166      ' ORDER BY ' + OrderColumn + ' ' + OrderDirection);
    166167
    167     LinkQuery := TQueryString.Create;
     168    LinkQuery := TQueryParameterList.Create;
    168169    LinkQuery.Assign(Request.Query);
    169170
     
    209210  OrderDirection: string;
    210211  Title: string;
    211   LinkQuery: TQueryString;
     212  LinkQuery: TQueryParameterList;
    212213begin
    213214  SqlDatabase := TSqlDatabase.Create;
     
    237238end;
    238239
     240procedure TWebServer.ServerInfo(Request: THTTPRequest; Response: THTTPResponse);
     241var
     242  I: Integer;
     243begin
     244  with Response.Stream do begin
     245    Response.Cookies.Values['Test'] := 'Halo';
     246
     247    WriteString('<a href="?ServerInfo">Refresh</a>');
     248
     249    WriteString('<h5>Request HTTP headers</h5>');
     250
     251    for I := 0 to Request.Headers.Count - 1 do begin;
     252      WriteString(Request.Headers.Strings[I] + '<br/>');
     253    end;
     254
     255    WriteString('<h5>Response HTTP headers</h5>');
     256    with Response.Stream do
     257    for I := 0 to Response.Headers.Count - 1 do begin;
     258      WriteString(Response.Headers.Strings[I] + '<br/>');
     259    end;
     260  end;
     261end;
     262
    239263procedure TWebServer.SendIndex(Request: THTTPRequest; Response: THTTPResponse);
    240264begin
     
    297321      Add('/ViewList', ViewList);
    298322      Add('/ViewItem', ViewItem);
     323      Add('/ServerInfo', ServerInfo);
    299324    end;
    300325  end;
Note: See TracChangeset for help on using the changeset viewer.