Draft Specification for automatically mapping URLs to Controllers and Views
Ted Husted has been working on a draft specification for "Heuristic Request/Response Mappings", based on technologies used by Rails, Struts 2 and Stripes.
The central idea is that instead of creating explicit mappings, the
framework applies a series of heuristic transformations to match a URI
with a code component and a view component.
The first part of the draft is available here:
* http://code.google.com/p/web-alignment-group/wiki/WAG_RFC_001
Before doing any more work on the description, I'd be very interested
on feedback as to whether I'm making any sense, or whether the draft
has turned into opaque gibberish :)
If you're developing a web framework (in any language) and use conventions to auto-map URLs-to-controllers and controllers-to-views, it'd be great to hear your feedback on this draft. It'd be pretty cool if you could switch frameworks/languages and use the same conventions across the board.
Posted by Renaud Bruyeron on November 02, 2007 at 07:18 AM MDT #
Posted by Guillaume Laforge on November 02, 2007 at 07:47 AM MDT #
Posted by Graeme Rocher on November 02, 2007 at 09:11 AM MDT #
I do a similar thing with my (personal) framework (feather.fourspaces.com - note: not quite ready for prime time), but automapping always scares me a bit. There is always one more constraint to add, another type of mapping that would be nice, or even another url scheme that should map to the same handler (method).
So, while I have default mappings of /controllerSimpleClassName/methodName, for me this actually ends up creating a set of Regular Expressions under the hood. Then for more fine grained mapping, you can apply annotations like @HttpPost, @Path("^/contact/(\d+)/view/$"), etc...
Ultimately, my feel for it is that the simple auto-mappings are great, until you need a little more flexibility... then it doesn't matter what the heuristic is, you'll still need to use whatever tools the framework gives you, be that annotations, xml config file, whatever. And at that point, you loose all of the cross-framework goodness, and you're back where you started.
Also regarding the RFC:
Posted by Marcus Breese on November 02, 2007 at 08:36 PM MDT #
-Ted.
Posted by Ted Husted on November 03, 2007 at 08:24 AM MDT #
Posted by Thiago HP on November 05, 2007 at 12:00 PM MST #
Posted by Mark Hughes on November 09, 2007 at 11:54 PM MST #