ScroogeXHTML for the Java™ platform example source code

Habarisoft released source code examples for its RTF to HTML/XHTML converter library, ScroogeXHTML for the Java™ platform. The download archive includes projects for the 4.5 and 5.0 releases.

Included examples

  • CSS based document size optimization
  • extraction of embedded pictures
  • Hyperlink field conversion (new in 1.0.1)
  • slf4j logging

Release notes

  • 1.0.1 – added hyperlink example (2015-04-26)
  • 1.0 – initial release (2015-04-24)

Picture support

ScroogeXHTML for the Java™ platform only supports the extraction of the raw binary picture data from the RTF document. Conversion of the binary data to a web-ready format (e.g., PNG or JPG) requires third-party libraries. No specific recommendation for a graphic library can be given by Habarisoft.

Other versions

ScroogeXHTML is also available for Free Pascal and Delphi.

ScroogeXHTML for the Java™ platform 4.6 on-line demo

Habarisoft launched a new on-line demo for the current development snapshot (4.6.0-a1) of its RTF to HTML/XHTML converter library, ScroogeXHTML for the Java™ platform. The 4.6 release will be a maintenance release which mostly includes bug fixes.

The on-line demo at https://secure.habariwebcomponents.de/sxd4/ allows to upload a RTF file and convert it to different output formats (HTML5, HTML 4.01 strict/transitional and XHTML 1.0 strict/transitional) using the 4.6 development snapshot of the converter library.

Note: a new major release is currently in development, which introduces experimental support for table conversion. A separate on-line demo version for the 5.0 release is available at https://secure.habariwebcomponents.de/sxd/.

Habari Web Components 2.10 released

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).

Changes in 2.10:

Indy 10.6.2
Tested with Internet Direct (Indy) version 10.6.2 r5268 .
Ticks64
The library uses IdGlobal.Ticks64 and GetTickDiff64.
Indy deprecated methods
The core library uses IndyTextEncoding_UTF8 instead of deprecated IndyUTF8Encoding.
On-line demo
The on-line demo has been updated from Habari Web Components version 2.5 to 2.10.

Online demo:  the “Kitchen Sink” online demo on https://secure.habariwebcomponents.de/demo/index.html runs on a Ubuntu Linux system (please note that Linux is not officially supported).

Demo download: The demo download contains documentation, tutorial project sources and the “Flightplan” executable demo which uses jQuery mobile.

Mobile app demo

 

Habari Web Components

ScroogeXHTML for the Java™ platform feature matrix

A feature matrix for the ScroogeXHTML RTF to HTML and XHTML converter library is now included on the product home page https://www.habarisoft.com/scroogexhtml_java.html

It shows the RTF elements which are supported in the current release version 4.5 and in the upcoming 5.0 release. Please note that the 5.0 release is currently in an early development stage. Version 4.5 is still the official (shipping) version.

Test your Delphi knowledge: Exception handling

With this code, what will happen:

program FunWithDelphi;

{$APPTYPE CONSOLE}

uses
  Controls, SysUtils;

begin
  try
    raise TMouse.Create;
  except
    on E:Exception do
    begin
      Writeln(E.Classname, ': E is Exception');
    end;
    on E:TObject do
    begin
      Writeln(E.Classname, ': E is TObject');
    end;
    on E:TMouse do
    begin
      Writeln(E.Classname, ': E is TMouse');
    end;
  end;
  ReadLn;
end.
  • the program will print “TMouse: E is Exception”
  • the program will print “TMouse: E is TObject”
  • the program will print “TMouse: E is TMouse”
  • compilation fails
  • the program will terminate with a runtime error

Continue reading

Indy 10.6 HTTPS POST example with JSON body

The Indy (Internet Direct) TIdHTTP now creates a default SSLIOHandler when requesting an HTTPS url. This makes TIdHTTP a little easier to use “out of the box”. (blog article).

The code below sends a hard-coded JSON object as POST body to a secure url. Note: if you need to customize the SSLVersions used, or specify certificates/keys, or use status/password event handlers, then you will still have to explicitly assign an SSLIOHandler component to the TIdHTTP.IOHandler property before sending an HTTPS request.

program JSONPostExample;

{$APPTYPE CONSOLE}

uses
  IdHTTP, IdGlobal, SysUtils, Classes;

var
  HTTP: TIdHTTP;
  RequestBody: TStream;
  ResponseBody: string;
begin
  HTTP := TIdHTTP.Create;
  try
    try
      RequestBody := TStringStream.Create('{"日本語":42}',
        TEncoding.UTF8);
      try
        HTTP.Request.Accept := 'application/json';
        HTTP.Request.ContentType := 'application/json';
        ResponseBody := HTTP.Post('https://httpbin.org/post',
          RequestBody);
        WriteLn(ResponseBody);
        WriteLn(HTTP.ResponseText);
      finally
        RequestBody.Free;
      end;
    except
      on E: EIdHTTPProtocolException do
      begin
        WriteLn(E.Message);
        WriteLn(E.ErrorMessage);
      end;
      on E: Exception do
      begin
        WriteLn(E.Message);
      end;
    end;
  finally
    HTTP.Free;
  end;
  ReadLn;
  ReportMemoryLeaksOnShutdown := True;
end.

Notes:

Program output:

{
  "args": {},
  "data": "{\"\u65e5\u672c\u8a9e\":42}",
  "files": {},
  "form": {},
  "headers": {
    "Accept": "application/json",
    "Accept-Encoding": "identity",
    "Content-Length": "16",
    "Content-Type": "application/json",
    "Host": "httpbin.org",
    "User-Agent": "Mozilla/3.0 (compatible; Indy Library)"
  },
  "json": {
    "\u65e5\u672c\u8a9e": 42
  },
  "origin": "*.*.*.*",
  "url": "https://httpbin.org/post"
}

HTTP/1.1 200 OK

RabbitMQ 3.5.0 free open source message broker released

The RabbitMQ team announced the release of RabbitMQ 3.5.0. This release adds support for priority queues which were available as a plugin before. Performance is improved; in particular messages smaller than configurable size are embedded in the queue index to reduce I/O and memory consumption. Stability of clustering and autoheal partition handling is improved as well. A new pause_if_all_down partition handling mode is added. The management web UI now shows many more I/O statistics. Binary and source distributions of the new release can be found on the download page.

For application integration in Delphi and Free Pascal, Habarisoft offers a commercial client library for RabbitMQ 3.4.0 and newer.

ScroogeXHTML 6.8 – fast RTF to HTML / XHTML converter

Habarisoft is pleased to announce the release of ScroogeXHTML 6.8, a fast RTF to HTML / XHTML converter library for Delphi and Free Pascal.

A off-line demo version, the “Getting Started” guide (PDF) and the complete API documentation are available.

An interactive on-line demo is available for ScroogeXHTML for the Java™ platform. (Please be aware that RTF table conversion is still experimental in the on-line demo and not available for Delphi yet).

 Release notes

  • Added ConvertFields property for field expressions (default False)
  • Added Hyperlink field support class TLinkURIBuilder
  • Added HTML Anchor support
  • Added unit SxConst which declares margins (configurable with SCROOGE_NO_INDENT option)
  • Documentation generated with doxygen 1.8.8
  • Use strict private scope where possible
  • Changed THyperlinkEvent signature to procedure(Sender: TObject; const TextElement: ISimpleDomTextNode) of object
  • Moved TRichEdit conversion to separate class TBTScroogeXHTMLVCL
  • Added HTTPS as protocol for RequireHTTP hyperlink option
  • Removed unused hyperlink option hyHyperlinkFootnotes
  • Tested with Free Pascal 2.6.4
  • Web demo built with Indy 10.6.2

Habari Client libraries release 2015.02

Habarisoft released new versions of Habari Client libraries for Delphi and Free Pascal application integration with free open source message brokers.

Tested with current message broker versions

  • Apache ActiveMQ 5.11.0
  • Apollo 1.7
  • HornetQ 2.4.0.Final
  • Open MQ 5.1 b09
  • RabbitMQ 3.4.3

Fixes

  • The throughput test application uses the subscribe.receipt=true connection parameter to ensure that the broker is ready before the producer starts sending messages

Improvements

  • Connection factory – As a preparation for further code streamlining between library versions, a new API compatible factory class TBTConnectionFactory is included in this version which will replace TBTJMSConnectionFactory in the next major release
  • Password logging – If Log4D logging is enabled, the passcode header value will be not be logged but replaced with *** in the log output
  • Optional units – Several units which are not covered by basic support have been moved to the source/optional directory (BTMessageTransformer*, BTStreamhelper, SSL support units)
  • Refactorings – Refactorings reduce unit dependencies and hard type casts in several places
  • Cleanup – Removed unused procedure TBTStompClient.Connect(const AURI: IURI)
  • Documentation – More documentation improvements and streamlining between library versions

Previous version release notes: Habari Client libraries release 2014.09

unittests.2015.02

 

Habari Client Libraries

 

Indy HTTP server: multipart/form-data file upload example

The Internet Direct (Indy) 10 HTTP server class TIdHTTPServer does support HTTP file upload with multipart/form-data encoding. The solution below is based on code in the Indy and Delphi newsgroups. Please note that a patch in the Indy library is required, as shown on Stackoverflow in Indy MIME decoding of Multipart/Form-Data Requests returns trailing CR/LF.

Usage

If the demo server runs, open a web browser and navigate to the URL http://127.0.0.1:8080, there you will find the upload form

Neue Bitmap

Source

The full source code can be found here: Indy MIME decoding of Multipart/Form-Data Requests returns trailing CR/LF.