click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Schellink (JIRA)" <>
Subject [jira] Commented: (CLK-564) Add ResourceService for serving static resources
Date Wed, 08 Jul 2009 08:48:14 GMT


Bob Schellink commented on CLK-564:

Great work on the implementation Malcolm.

Some comments:

- Testing Click examples on Tomcat and setting the context.xml property, unpackWAR="false",
gives error when accessing the ExceptionDemo. Velocity complains that it cannot find error.htm.
Problem is that error.htm should be looked up from "META-INF/resources/click/error.htm". One
solution could be to enhance Velocity/FreemarkerTemplateService with the following:

  public void renderTemplate(Page page, Map model, Writer writer) throws Exception {

    String templatePath = page.getTemplate();
    boolean canDeploy = canDeploy();
    if (!canDeploy) {
      templatePath = "META-INF/web" + templatePath;

- Currently the solution only caters for resources under the "/click/" folder. It would be
nice if all mapped resources would be served

- The caching solution might end up caching Velocity resources. Consider the following:


  "my-page.htm" and "my-page-js" are Velocity templates and should not be cached as it won't
be requested by the browser.

  One solution is a lazy on-demand cache. Instead of loading resources upfront, we only load
resources when requested. It would mean
  switching the cache to a ConcurrentHashMap though.

> Add ResourceService for serving static resources
> ------------------------------------------------
>                 Key: CLK-564
>                 URL:
>             Project: Click
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
> 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.

View raw message