Harfang release 1.0.0-alpha.1

73 views
Skip to first unread message

Nicolas Juneau

unread,
Feb 7, 2016, 9:53:48 PM2/7/16
to Haxe language and help discussion group
Hello fellow Haxe users,

It's been a while since the Harfang framework saw a release!

I just released version 1.0.0-alpha.1 of the framework on Haxelib. As
the version implies, this is not the final version. Do not use in
production (unless you like danger and adventure)!

The API has evolved since 0.4 and if you wonder what could make me skip
5 releases to end up at 1.0.0, it is only to respect semantic
versioning. This version introduces API breaks.

So, here's a quick breakdown of the changes since 0.4. They will be
documented on the project's wiki in time for the final release.

MacroConfigurator is gone
-------------------------

Yes, the MacroConfigurator is now gone as a standalone class. It was
becoming a mess where all the macros would be dumped in. Therefore, it
has been separated in more coherent units:

* URLMappingFactory (for custom implementations of URLMapping)
* ERegURLMappingFactory (for the default ERegURLMapping implementation)

Since the method signatures have changed since 0.4, the name of the
functions have slightly changed in order to prevent some unintentional
errors that could go under the radar.

One cool new feature added in 1.0.0 is the possibility to specify your
very own URLMapping implementation to the factory. Hence, if you don't
use the default URLMapping implementation, you can still benefit from
the macros provided in the factories (tutorial to write on the wiki).

Another feature that was added was HTTP method filtering. This is best
demonstrated with a little sample code:

@URL("^/a/$")
@Method("POST")
public function handleRequestPostOnly() : Void { ... }

As you probably guessed, you can now filter requests by both URL and
HTTP method. You just need to tell the factory which name you gave to
your HTTP method metadata. Pretty handy if you're into Web services.

AbstractServerConfiguration no longer implements ServerEventListener
--------------------------------------------------------------------

Server-side events have been there since 0.1, but in version 0.3, a
proper interface to describe server-side events was written. In order to
remain compatible with previous releases, the
AbstractServerConfiguration class implemented the ServerEventListener
interface.

However, I have cleaned this up for 1.0.0. That means that the
configuration class has only two events occurring directly on it: init
and close. For all other events (like listening to dispatch or error
events), a listener must be explicitly declared an added to the list of
server event listeners in the configuration.

Or, if you wish to retain the same event listening behavior as before,
make your configuration class implement the ServerEventListener
interface and add your configuration class to the list of event listeners.

Compile-time ServerConfiguration selection
------------------------------------------

In previous versions of Harfang, the developer was forced to declare its
configuration in the "server.UserConfiguration" class. While this is
still the default location, you can now specify where your configuration
resides using this macro in your build file:

--macro
harfang.server.ServerMain.setServerConfigurationClass('hello.HelloProject')

Since this is Alpha 1, the API is still subject to change. However, if
there are any changes to make, they will surely be based on your
feedback. In fact, most of the changes I've implemented were motivated
by questions I've received or bugs that have been submitted by you.

So, without further ado, here are all the links you need:

* https://github.com/njuneau/Harfang (For the source and docs)
* http://lib.haxe.org/p/Harfang/1.0.0-alpha.1/ (Haxelib release information)

As always, thanks in advance to all of the framework's users. It's your
feedback that makes it evolve and improve over time! If you have any
questions related to the alpha or experience difficulties, don't
hesitate to post in this thread or start one with "Harfang" somewhere in
the title so I can easily find it.

The documentation on Github is still incomplete - there's a lot of stuff
to move on from the old Haxe site, but the objective is to have the docs
completed before the final release.

Enjoy!
--
Nicolas Juneau
Reply all
Reply to author
Forward
0 new messages