You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Andrey Rybin (JIRA)" <ji...@apache.org> on 2010/04/25 10:49:50 UTC

[jira] Created: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Click Page Templates in class path (in addition to webRoot [sub- ]folders)
--------------------------------------------------------------------------

                 Key: CLK-665
                 URL: https://issues.apache.org/jira/browse/CLK-665
             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
 how I use Spring for building these separate jar with separate spring's xmls into one application.

See also excellent article about this modular concept:
http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 


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 
https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Andrey Rybin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860681#action_12860681 ] 

Andrey Rybin commented on CLK-665:
----------------------------------

Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)

> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860677#action_12860677 ] 

Bob Schellink commented on CLK-665:
-----------------------------------

All the options available for static resources apply to templates as well, except the ResourceService which by default only works for resources under the '/click' folder anyway.

You can always implement a custom ConfigService or extend XmlConfigService to use the Spring lookup mechanism you mention above.

> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Issue Comment Edited: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Andrey Rybin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860681#action_12860681 ] 

Andrey Rybin edited comment on CLK-665 at 4/25/10 9:04 AM:
-----------------------------------------------------------

Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)

But I think: It is cool thing for Click-core.

PS: ResourceService won't work for Page Templates at all.
Because it isn't used for Page mapping.

      was (Author: andreyrybin):
    Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)

But I think: It is cool thing for Click-core.
  
> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Issue Comment Edited: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Andrey Rybin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860681#action_12860681 ] 

Andrey Rybin edited comment on CLK-665 at 4/25/10 9:05 AM:
-----------------------------------------------------------

Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)

But I think: It is cool thing for Click-core.

PS: ResourceService won't work for Page Templates at all.
Because it isn't used for Page mapping.

No mapping - no page, so htm template itself won't be used.

      was (Author: andreyrybin):
    Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)

But I think: It is cool thing for Click-core.

PS: ResourceService won't work for Page Templates at all.
Because it isn't used for Page mapping.
  
> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Andrey Rybin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860676#action_12860676 ] 

Andrey Rybin commented on CLK-665:
----------------------------------

>Why not package each module templates under META-INF/resources?

I think It won't work in restricted environment.

Static resources are ok. They have many options:
http://click.apache.org/docs/user-guide/html/ch04s03.html#deploying-restricted-env

But Page Templates aren't static resources.
Click should find them in webRoot.
If deployResourcesOnClasspath fails, then Click won't find Page Templates from JAR.


> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860672#action_12860672 ] 

Bob Schellink commented on CLK-665:
-----------------------------------

Why not package each module templates under META-INF/resources?

http://click.apache.org/docs/user-guide/html/ch04s03.html#deploying-custom-resources

> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Andrey Rybin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862190#action_12862190 ] 

Andrey Rybin commented on CLK-665:
----------------------------------

Yes, it looks good!

But you will have some rough edges with 'lazy' load.
For example: setRedirect(Class<? extends Page> pageClass) will be tricky.


> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Issue Comment Edited: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Andrey Rybin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860681#action_12860681 ] 

Andrey Rybin edited comment on CLK-665 at 4/25/10 9:00 AM:
-----------------------------------------------------------

Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)

But I think: It is cool thing for Click-core.

      was (Author: andreyrybin):
    Of course I will do my XmlConfigServiceEx (it looks easy with Click's DeployUtils class) if Click dev team official answer for this Improvement will be No ;-)
  
> Click Page Templates in class path (in addition to webRoot [sub- ]folders)
> --------------------------------------------------------------------------
>
>                 Key: CLK-665
>                 URL: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.


[jira] Commented: (CLK-665) Click Page Templates in class path (in addition to webRoot [sub- ]folders)

Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862000#action_12862000 ] 

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.

ConfigService:
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: https://issues.apache.org/jira/browse/CLK-665
>             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 - http://static.springsource.org/spring/docs/2.0.x/reference/resources.html#resources-app-ctx-wildcards-in-resource-paths -
>  how I use Spring for building these separate jar with separate spring's xmls into one application.
> See also excellent article about this modular concept:
> http://blogs.reucon.com/srt/2007/07/06/modular_spring_configuration.html 
> 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 
> https://issues.apache.org/jira/browse/CLK-622 (~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.