My mistake.. I was calling setId() not setViewId()
If I do something like this, I get a bit farther, the viewId is registered,
and I get a 404 error from the container:
*The requested resource (/META-INF/dynapage.xhtml not found) is not
available.*
Same if I use the resource string format.
*The requested resource
(file:/home/lb3/Projects/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/dyna/WEB-INF/classes/META-INF/dynapage.xhtml
not found) is not available.*
Still trying to track down where the ViewId is resolved to an actual file.
@Override
public UIViewRoot createView(final FacesContext context, String viewId)
{
PrettyContext prettyContext = PrettyContext.getCurrentInstance();
if (prettyContext.isDynaView())
{
URL resourceUrl =
Thread.currentThread().getContextClassLoader().getResource("/META-INF/dynapage.xhtml");
viewId = resourceUrl.toString();
viewId = "/META-INF/dynapage.xhtml";
ViewDeclarationLanguage vdl =
getViewDeclarationLanguage(context, viewId);
UIViewRoot viewRoot = vdl.createView(context, viewId);
return viewRoot;
}
return parent.createView(context, viewId);
}
On Thu, Nov 5, 2009 at 7:19 PM, Lincoln Baxter, III <lincolnbaxter_at_gmail.com
> wrote:
> Well... the resource naming does not work. Blows up in UIComponentBase.
>
> private static void validateId(String id) {
>
> if (id == null) {
> return;
> }
> int n = id.length();
> if (n < 1) {
> throw new IllegalArgumentException("Empty id attribute is not
> allowed");
> }
> for (int i = 0; i < n; i++) {
> char c = id.charAt(i);
> if (i == 0) {
> if (!Character.isLetter(c) && (c != '_')) {
> throw new IllegalArgumentException(id);
> }
> } else {
> if (!Character.isLetter(c) &&
> !Character.isDigit(c) &&
> (c != '-') && (c != '_')) {
> throw new IllegalArgumentException(id);
>
> }
> }
> }
>
> }
>
> On Thu, Nov 5, 2009 at 5:58 PM, Lincoln Baxter, III <
> lincolnbaxter_at_gmail.com> wrote:
>
>> Thanks, Jason!
>>
>>
>> resourceUrl =
>> Thread.currentThread().getContextClassLoader().getResource(resource);
>>
>> I'm thinking there may be some possibilities with the ClassLoader
>> generating a URL that would become the ViewId... but it sounds very hit or
>> miss if JSF would be able to use that... probably a miss.
>>
>> Gonna keep banging my head on it,
>> --Lincoln
>>
>>
>> On Thu, Nov 5, 2009 at 5:55 PM, Jason Lee <jasondlee_at_sun.com> wrote:
>>
>>> On Nov 5, 2009, at 4:44 PM, Lincoln Baxter, III wrote:
>>>
>>> I think that should be possible... how would you recommend I point
>>> VDLFactory at the file on the classpath. Is there a way to get it to accept
>>> a URL, or a resource?
>>>
>>>
>>> Util.notNull("context", context);
>>> String actualViewId = derivePhysicalViewId(context, viewId,
>>> false);
>>> return
>>> vdlFactory.getViewDeclarationLanguage(actualViewId).createView(context,
>>>
>>> actualViewId);
>>>
>>> Or do I even need to do this as long as all of the Handlers know to
>>> translate the custom ViewId into something real?
>>>
>>> I guess I'm a little lost since it looks like everything I would do to
>>> "Build a UIViewRoot" requires a String viewId... which I'm not sure would
>>> let me do what I need to with the classpath.
>>>
>>>
>>> That's a good question. I've considered the issue you're trying to solve
>>> in passing over the past couple of weeks, but haven't gone much deeper than
>>> the ViewHandler (too many other irons in the fire). I'll see if I can give
>>> that some more active thought. Which doesn't help you now, but we'll see
>>> what I can find on my end. :)
>>>
>>> <http://www.java.com> * Jason Lee *
>>> Senior Java Developer
>>> GlassFish Administration Console
>>>
>>> *Sun Microsystems, Inc.*
>>> Phone x31197/+1 405-343-1964
>>> Email jasondlee_at_sun.com
>>> Blog http://blogs.sun.com/jasondlee
>>> Blog http://blogs.steeplesoft.com
>>>
>>>
>>
>