Habari Web Components 2.8 released

The new release 2.8 of the web application framework for Delphi and Free Pascal is available now. Changes include:

  • FPCUnit test project
  • validation of context names and mappings
  • new tutorials with source code
  • updated Flightplan demo for jQuery Mobile
  • Log4D (logging framework) source code workarounds for Free Pascal

Flightplan Demo (using jQuery Mobile 1.4.2)

DUnit and FPCUnit Tests

FPCUnit Tests

About

Habari Web Components is a web application framework for small to medium size HTTP services, based on the popular open source TCP/IP library for Delphi and Free Pascal, Internet Direct (Indy). If you like to see it in action, download and run the off-line demo applications, or go to the on-line demo. Need more information? Browse the on-line API documentation, or read the Getting Started document.

  • supports Delphi 2009 and Free Pascal 2.6.0 or newer with Internet Direct (Indy) 10.6
  • full source code included, with DUnit/FPCUnit tests and example applications
  • redistribution with your application does not require any additional fees
  • free updates for one year

Example source code for Hello World web component

This web component answers HTTP GET requests with a hello world response (content type text/plain). The full tutorial project code is included in the demo download.

unit HelloWorldResource;

interface

uses djWebComponent, IdCustomHTTPServer;

type
  THelloWorldResource = class(TdjWebComponent)
  public
    procedure OnGet(
      Request: TIdHTTPRequestInfo;
      Response: TIdHTTPResponseInfo); override;
  end;

implementation

procedure THelloWorldResource.OnGet(
  Request: TIdHTTPRequestInfo;
  Response: TIdHTTPResponseInfo);
begin
  Response.ContentText := 'Hello world!';
  Response.ContentType := 'text/plain';
end;

end.

 

Habari Web Components

Advertisements

2 thoughts on “Habari Web Components 2.8 released

  1. How about support on Habary Web Components?
    I want to develop a small web database application (embedded – stand alone).
    Using Delphi for a long time, but still newbie on HTML5.
    Still confused on how to manage user session and cookies.
    Already trying using Indy 10 but always stopped at this point.
    Do you have an example how to manage user session and cookies using Habary Web Components?
    At least there must be a login form (to do authorization).
    We must know who this user is too (to do audit trail).

    best regard
    irawan

    • An example is included in the full version. All pages can be protected with a security handler. It contains this code to detect a logged in user:

      Session := GetSession(Context, Request, Response, True);

      IsLoggedIn := Session.Content.Values[‘auth:user’] ”;

      if not IsLoggedIn and (Target <> ‘/web/login.html’) then
      begin
      // not logged in: redirect to login form
      Session.Content.Values[‘auth:target’] := Request.Document;
      Response.Redirect(‘/web/login.html’);
      end
      else
      begin
      // pass
      inherited;
      end;

      I will send you the full source code later today.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s