tiles-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mick Semb Wever <...@apache.org>
Subject Re: Implementing Tiles Request (2/3): Calling an alien API
Date Sat, 01 Sep 2012 05:36:43 GMT

> > It's some extra work at coding, but it doesn't interfere with the
> > loading of the initial template, so the testing and debugging should be
> > easier. 
> 
> It sounds about right yes. I'll take a closer look at
> DeferringMustacheFactory.

Maybe i'm blind but i can't see any satisfactory solution here.
The visitor pattern provides the "deferring" functionality, and that is
only for the rendering of the partial, not the load/compile of it.

What we are trying to do is add a context to MustacheFactory where one
previously doesn't exist, a hint that lambdas are better suited.
It would be better if the definition name was also explicit in the
partial, eg {{>definitionName/attributeName}} but in practice often you
would want definitionName to be relative, ie the current definition.


> > We're still working our way through things (it's important that
> > including partials by tiles attribute names works both client and server
> > side), it may well be that we use lambdas instead of partials... and
> > that leads to implementing an autotag implementation against lambdas.
> 
> I was thinking of implementing something (a DefinitionRenderer?) that
> evaluates all the definition attributes first, and delivers the results
> as request attributes (through a RequestWrapper, and possibly an extra
> scope "definition") before calling the definition template.

Indeed we're working on that problem.
AttributeContext provides what we want.

Our first attempt is simply to dump all attributes as a
Map<String,Object> into the request scope under the name "tiles" (in a
subclass of the MustacheRenderer). But this might not work so smoothly
client side.

Which brings us back to lambdas, as they might be easier to implement
with one javascript library than to provide examples on how to make the
client-side stuff compatible…
(lambdas weren't our first approach as they were in mustache java 0.6).

Either way the server must provide a url that returns a json object
holding all tiles attributes. But that is easy enough to demonstrate how
to do.

~mck


-- 
"A mind that has been stretched will never return to its original
dimension." Albert Einstein 

| http://github.com/finn-no | http://tech.finn.no |

Mime
View raw message