click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Schellink (JIRA)" <>
Subject [jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)
Date Wed, 28 Apr 2010 23:47:49 GMT


Bob Schellink commented on CLK-665:

Agreed on ResourceService. Even if it did work, it will cache the templates and so will Velocity
leading to duplicated storage.

Having thought about this a bit I don't think packaging classes and template together is very
useful. I also don't know how to document and explain the pros of this approach to users as
I think packaging templates under the 'web' folder is superior. The current behavior is both
predictable (url to template maps 1 to 1), easily customizable and well documented.

That said I do think it should be easier to change the template location path to support this
use case if users really want it.

On a related note, we have an issue on GAE (CLK-639) where it does not allow scanning of the
'web' folders for templates. Thus Click doesn't work on GAE in production modes. Ideally this
can be solved by leveraging a 'lazy' design where templates are only looked up when accessed
the first time. In such a scenario we should be able to cater for custom template locations,
such as looking it up from the classpath.

public String lookupTemplateFromUrl(String url);

Would this be useful to you?

> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>                 Key: CLK-665
>                 URL:
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.2.0, 2.1.0
>            Reporter: Andrey Rybin
> I have a large web application  composed from several independent modules packaged as
separate .jar files in WEB-INF/lib.
> Now Click force me to copy all my .htm files (Page Templates) to 'main' module's webRoot
folder (parent folder of WEB-INF), because Click look for templates only in webRoot folder
and its subfolders (see XmlConfigService.getTemplateFiles), and then I have big htm midden
in webRoot.
> I can't make reusable just-drop-in jar-module for somebody else. 
> I have to make separate zip with htm templates with readme.txt with instructions where
to copy them.
> Please! Add option to look Page templates in classpath too.
> See -
>  how I use Spring for building these separate jar with separate spring's xmls into one
> See also excellent article about this modular concept:
> I.e. Click could  look in (for example) META-INF/ClickPageTemplates for Page mappings.
> Then both Velocity and Freemarker can load templates from classpath.
> PS: It looks like hand-made-OSGi.
> PPS: See also 
> (~reversed situation: we have .htm, but
don't have class).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message