On 9/21/06, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>From: "Ryan Wynn" <[EMAIL PROTECTED]>
>
>
> Gary, that looks really interesting I'll give it a try. I think it's
> just a different way off looking at the same thing. I'm not too
> concerned with the actual extension. It's more the indirection.
>
> I was try to shorten
>
>
>viewId = org/blue/page1.html
>
><component jsfid="org/blue/page1.html" extends="basePage">
>      <symbols>
>          <set name="@templatePackage" value="org/blue/usecases/templates"/>
>          <set name="@page" value="home.chtm" />
>      </symbols>
>   </component>
>
>to
>
>viewId = classpath*:org/blue/usecases/templates/home.chtm
>
>so that I can bypass indirection like
>
><navigation-rule>
>   
<from-view-id>classpath*:org/blue/usecases/templates/home.chtm</from-view-id>
>        <navigation-case>
>            <from-action>#{bean.changeColor}</from-action>
>            <from-outcome>green</from-outcome>
>            <to-view-id>classpath*:org/green/usecases/templates/home.chtm
>                </to-view-id>
>        </navigation-case>
></navigation-rule>
>
> Such that the clayJsfid of the root clay component would be
> interpreted as classpath*:org/blue/usecases/templates/home.chtm or
> classpath*:org/green/usecases/templates/home.chtm

Ah, I see.  The URL would look something like 
http://localhost:8080/myapp/classpath*:/org/apache/shale/error.html

That's a funky URL but it seems to be valid.  I gave this a test and you are 
only one character from making this work.
The view id always starts with a "/".  The logic looks for the "classpath*:" at 
the start of the resource.
If it starts with "classpath*:", the class loader is used rather than the 
servlet context to load the resource.

Do you think it would okay if we changed the load from class loader
logic to look for either classpath*: or /classpath*: at the start of
the resource? Then the view id can be kept consistently with the /.

Would something like this in ClayViewHandler:renderView work?

String viewId = normalizeViewId(view.getViewId(), index);
view.setViewId(viewId);  // always starts with /
             component =
context.getApplication().createComponent(CLAY_COMPONENT_TYPE);
             ((Clay) component).setId(CLAY_VIEW_ID);
if (mappedToClasspath(viewId) {
    ((Clay) component).setJsfid("clay");
     ((Clay) component).setClayJsfid(stripLeadingChar(viewId);
} else {
    ((Clay) component).setJsfid(viewId);
}
((Clay) component).setManagedBeanName(getManagedBeanName(context, viewId));
             view.getChildren().add(view.getChildren().size(), component);
           }



java.lang.NullPointerException: Component not found 
"/classpath*:/org/apache/shale/error.html".

The ClayViewHandler might be able to strip off the character to support 
something like this but we might find other issue
with the navigation.

The from-view-id would expect the "/" character.
<from-view-id>/classpath*:org/blue/usecases/templates/home.html</from-view-id>

Gary


Gary

Reply via email to