forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: Fallback resolver Vs. Locationmap (was Re: svn commit: r233401 - in /forrest/trunk: main/webapp/ main/webapp/WEB-INF/xconf/ site-author/ whiteboard/plugins/org.apache.forrest.plugin.internal.view/ whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/ whiteboard/plugi...)
Date Fri, 19 Aug 2005 13:45:13 GMT
On Fri, 2005-08-19 at 09:52 +0100, Ross Gardler wrote:
> thorsten@apache.org wrote:
> > Author: thorsten
> > Date: Thu Aug 18 17:44:00 2005
> > New Revision: 233401
> > 
> 
> ...
> 
> > Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/src/java/org/apache/forrest/plugin/internal/view/acting/FallbackResolverAction.java
> 
> Does this fallback resolver work with the locationmap?
> 

What do you mean?

> What does this do that the locationmap does not do?
> 

It computes a dynamic path for fallback file.

+    public void computeResponseURI(SourceResolver resolver, String uri)
{
+        if (this.resourceExist(resolver, uri)) {
+            fallbackHelper.setResponseURI(uri);
+        } else {
+            if (fallbackHelper.getRest().lastIndexOf("/") > -1) {
+
fallbackHelper.setRest(fallbackHelper.getRest().substring(0,
+                        fallbackHelper.getRest().lastIndexOf("/")));
+                uri = fallbackHelper.getProjectDir() +
fallbackHelper.getRest()
+                        + "/" + fallbackHelper.getProjectFallback()
+                        + fallbackHelper.getProjectExtension();
+                this.computeResponseURI(resolver,uri);
+            }else{
+                uri = fallbackHelper.getProjectDir()
+                    +fallbackHelper.getProjectFallback()
+                    +fallbackHelper.getProjectExtension();
+                if (this.resourceExist(resolver, uri)) {
+                    fallbackHelper.setResponseURI(uri);
+                }
+            }
+        }
+    }

The locationmap needs to be defined and edited. All fallbacks that you
want to use, you have to define before, not very suitable for a high
dynamic environment like views. 

The action reads a location (uri) and scans it whether a file exist. If
not it will scan for any project specific fallbacks that may exist (see
above). After this it scans further for default fallbacks (see
FallbackResolverAction.java). Actually in above code we now can easily
instance the SourceTypeAction [1] and implement "content aware
views" (FOR-621). 

Can the loactionmap help me with all that?

salu2
[1] http://forrest.apache.org/docs_0_80/cap.html
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Mime
View raw message