tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David White <dw11...@onemail.at>
Subject PATCH: fix for asset service (branch-3-0 2005-03-16)
Date Mon, 21 Mar 2005 09:52:40 GMT
So, here is the diff from branch-3-0 as of 2005-03-16.

The basic idea is to enter the path to PrivateAssets into the engine's
Pool when the PrivateAsset is rendered. Instead of simply using the path
provided by the user, the AssetService looks up the given path in the
Pool to see if it has been "declared" in a page or component
specification. If the path has not been pooled, the request is treated
as a request for a missing resource.

Thinking about this matter carefully, I think I can see some real use
cases for MD5 content validation; consider ExternalAssets. It would be
nice to know that the URL is still pointing to the desired content, and
some mischievious person hasn't copied tubgirl.jpg over the URL's
referent. So a good solution would permit MD5 hashing for some
resources, but not require it for all assets.

Questions? Comments?



Index: framework/src/org/apache/tapestry/asset/AssetService.java
file: /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tapestry/asset/Attic/AssetService.java,v
retrieving revision 1.8
diff -r1.8 AssetService.java
> import org.apache.tapestry.IEngine;
<         String resourcePath = (String) parameters[0];
<         URL resourceURL =
<         if (resourceURL == null)
<             throw new ApplicationRuntimeException(
<                 Tapestry.format("missing-resource", resourcePath));
>         IEngine theEngine = cycle.getEngine();
>         String resourceHandle = (String) parameters[0];
>         String resourcePath =
>         URL resourceURL = resourcePath != null ?
theEngine.getResourceResolver().getResource(resourcePath) :
>                               null;
>         if (resourcePath == null || resourceURL == null)
>                       throw new ApplicationRuntimeException(
Tapestry.format("missing-resource", resourceHandle));
Index: framework/src/org/apache/tapestry/asset/PrivateAsset.java
file: /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tapestry/asset/Attic/PrivateAsset.java,v
retrieving revision 1.7
diff -r1.7 PrivateAsset.java
> import org.apache.tapestry.IEngine;
>         IEngine engine = cycle.getEngine();
>         engine.getPool().store(path,path);

David White <dw11610@onemail.at>

To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org

View raw message