You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Bob Schellink (JIRA)" <ji...@apache.org> on 2010/01/18 12:18:54 UTC

[jira] Issue Comment Edited: (CLK-564) Add ResourceService for serving static resources

    [ https://issues.apache.org/jira/browse/CLK-564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774278#action_12774278 ] 

Bob Schellink edited comment on CLK-564 at 1/18/10 11:17 AM:
-------------------------------------------------------------

Hi Malcolm,

I've checked in a change to the ClickResourceService to serve resources lazily. This has some advantages over eager loading:

- resources won't be loaded if they are not requested. This resolves the issue with eager loading where all resources from jars are loaded, even if some of those resources aren't valid static resources, for example Velocity templates with extensions other than .htm.

- removed all duplicate code shared with XmlConfigService

- with lazy loading it was easy to add the ability to only cache resources in production modes

The only feature still outstanding is how to handle the case where Velocity attempts to render a template contained under META-INF/resources. Currently the VelocityTemplateService caters for two built in templates (error.htm and not-found.htm), but won't handle custom templates. I suppose we can cross that bridge when we get there.


      was (Author: sabob):
    Hi Malcolm,

I've checked in a change to the ClickResourceService to serve resources lazily. This has some advantages over eager loading:

- resources won't be loaded if they are not requested. This resolves the issue with eager loading where all resources from jars are loaded, even if some of those resources aren't valid static resources, for example Velocity templates with extensions other than .htm.

- removed all duplicate code shared with XmlConfigService

- with lazy loading it was easy to add the ability to only cache resources in production modes

The only feature still outstanding is how to handle the case where Velocity attempts to render a template contained under META-INF/resources. Currently the VelocityTemplateService caters for two built in templates, but won't handle custom templates. I suppose we can cross that bridge when we get there.

  
> Add ResourceService for serving static resources
> ------------------------------------------------
>
>                 Key: CLK-564
>                 URL: https://issues.apache.org/jira/browse/CLK-564
>             Project: Click
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 2.1.0 RC1
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>             Fix For: 2.1.0
>
>         Attachments: report_1.html, report_2.html, report_3.html
>
>
> The Click static resource deployment strategy of writing *.htm, *.css and image files to the web application /click/ directory does not work on all application servers. In particular WebLogic and WebSphere have security restrictions which prevent this from occuring. In these scenarios users are have to deploy these applications to the WAR file at build time.  Google GAE also does not support this deployment mode.
> A solution to this problem is to use the ClickServlet to serve these resources. By adding an additional web.xml mapping:
> 	<servlet-mapping>
> 		<servlet-name>ClickServlet</servlet-name>
> 		<url-pattern>/click/*</url-pattern>
> 	</servlet-mapping>
> The ClickServlet could use a ResourceService interface obtained from the ConfigService which returns the resource data. A default ClickResourceService would be provided which loads all the resources at application initialization time. This service would scan all the JAR files for resources in META-INF/web as is currently done in XmlConfigService and would cache them in memory. The service would also scan all the resources under the WAR /click/ directory. These resources would override any defined in the application JAR files.
> This could be a good feature for 2.1.0, we should possibly delay the 2.1.0 RC release to include this feature.

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