I hope the new year becomes even happier with a new haXigniter version! This time the version jump was up to 0.9, because there are some nice additions here that makes the whole library more stable and flexible.
The two main features are these:
1. A Router interface is added to the configuration, so you can control how the controllers are created from the request URL. The basic behavior is to create the controller from the first segment of the URL and the config.packageName property, so a request like "/start/index/123" will create the controller "controllers.Start" if config.packageName = "controllers". This works fine most of the time, but perhaps you want to create a controller based on a GET query instead, like many other frameworks do today. That is now quite easy with the Router interface.
2. Controller interface is extended with a contentHandler property. This is also an interface, but for input and output handling of POSTed data. A common use is to do automatic conversions of input data to a haXe object. If the input is xml for example, the ContentHandler can parse it and pass the Xml object to the RequestHandler, which in turn can pass it on to the Controllers in the way it chooses. An implementation for haXe objects is supplied, so with only a few lines of code you can now transparently send objects between a client and your Controllers.
Another example that can be really interesting is automatic conversion of input formats to another (xml, json, yaml, etc). Shouldn't be too much problem with the new handlers. If you have any ideas about that, please mail them here! I'm very interested in a streamlined format conversion process.
One last thing, there are a few interface changes, so if you're upgrading from 0.8x to 0.9, please read the upgrade notes here:
http://wiki.github.com/ciscoheat/haxigniter/updating
And also, if you need the latest haxelib (before 2.05 is released) that handles tags:
http://lists.motion-twin.com/pipermail/haxe/attachments/20091201/50dd1817/haxelib-0001.zip
Have fun!
v0.9 (2010-01-03)
=================
Features
- Added haxigniter.common.libraries.ParsedUrl for convenient parsing of urls. Used in request handlers.
- Added haxigniter.server.routing.Router, which can be sent to Application.run() to create controllers
for the incoming requests.
- Added Url.segmentString(), which rewrites the request path to a proper segment string, taking
mod_rewrite into account. Request handlers are encouraged to use this method.
- Added haxigniter.server.routing.Alias, an early version of url path rewriting. Will support
bidirectional aliasing later.
- Added haxigniter.server.content.ContentHandler, an interface for transforming input and output content
from/to a controller to different charsets, mimetypes, etc.
- Added haxigniter.server.content.HaxeRequestContent, a content handler for remoting of haxe objects.
- haxigniter.server.request.BasicHandler now has a property for the GET/POST data sent to it.
- Added config.Router, so a Router can be specified in the configuration.
- Cleaned up and commented the skeleton project files, and also the documentation for the run.n.
- Improved development mode detection in skeleton config file.
Changed
- RequestHandler interface now uses a ParsedUrl instead of just path.
- RequestHandler interface now accepts any data instead of raw posted data, so the ContentHandler can
modify it.
- haxigniter.server.Controller interface is now public for all properties, instead of just read-only.
Please update your controller class implementations.
- The Request library now handles all external and internal requests in haXigniter.
Bug fixes
- Logging RestApiExceptions in RestApiHandler now works if logger property is set.