Templates.render(Object instance); // reads @Show from class
Templates.render(Object instance, String template); // arbitrary bean
Hi All,really cool feature. What about documenting all these dispatching options?I am pretty lost in them all :)
On Fri, Mar 25, 2011 at 3:41 PM, Colin Decker <cgde...@gmail.com> wrote:Awesome! I didn't have much chance to try it out last night, and when I did it didn't seem to work with an @Decorated page (got an exception if I added @Service). Also, does the template class have to have @Show, or can it just be a class that uses a template with the same name?
show details 5:13 PM (14 hours ago)
Awesome feature ! Thanks Dhanji, you are doing a great job.
Now I don't have to use any custom made template evaluator when I have to sent html content to our GWT client that is using GWT-RPC.
BTW, Does it executes methods that are annotated with @Get or @Post ?
Nice work!
show details 7:55 PM (11 hours ago)
Is the only reason for passing TClass to read the name of the template from @Show? If so then perhaps passing a String template name would be better?
Is the context instance ever going to not be of type TClass? If not then the interface could become:
Templates.render(Object instance); // reads @Show from class
Templates.render(Object instance, String template); // arbitrary bean
By this do you mean does it execute @Get/@Post on the template class as a sort of lifecycle thing? No it currently does not... Would that be useful? The intention is to call these templates from a @Get or @Post method of a @Service anyway...
The ScanAndCompileBootstrapper registers classes marked @Decorated as
embbeded pages. Perhaps this step is missing causing the decorated
pages not to be found by DecorateWidget
But with your new Templates class I could skip this step... I think.
I'll give it a crack.
Thanks for the kind words everyone! Clarifications below.
Is the only reason for passing TClass to read the name of the template from @Show? If so then perhaps passing a String template name would be better?
Yea, I have a use case where I tunnel multiple RPCs over a single HTTP request/resp. These are dispatched by a custom handler to my own XXXRpc classes, which the @Show works nicely for. I'm open to using arbitrary string names too, but that would make it harder to pre-process and pre-load all the templates at start time in production mode.
Is the context instance ever going to not be of type TClass? If not then the interface could become:
Templates.render(Object instance); // reads @Show from class
Templates.render(Object instance, String template); // arbitrary bean
It could be, MVEL accepts Maps as equivalent to objects for instance, so I don't want to add that restriction.
We could make a convenience overload that doesn't require the Class, but then you have to deal with anonymous subclasses, proxies and such--by walking up the class hierarchy.
Hi,i just made simple workaround to get Decorators working with Template API.=mb=
Dňa piatok, 25. marca 2011 15:41:37 UTC+1 Colin Decker napísal(-a):