You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mario Ivankovits <ma...@ops.co.at> on 2005/12/22 16:49:01 UTC

NavigationHandlerImpl and viewId

Hi!

In NavigationHandlerImpl around line 145 there is the following code

ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
//create new view
String newViewId = navigationCase.getToViewId();
UIViewRoot viewRoot = viewHandler.createView(facesContext, newViewId);
viewRoot.setViewId(newViewId);

now I have a problem with the last statement.
My viewHandler create a view with a slightly different viewId. The 
setViewId(newViewId) cause the browser to view a "requested resource not 
available" message.

If I cange this to:

viewRoot.setViewId(viewRoot.getViewId());

it works like a charme.
If I create a patch, is it possible to have it applied - or is it needed 
to be RI compliant?

If so, I can handle my use case by overloading the NavigationHandler, 
but then I'll really appreciate if we can make 
calcMatchingNavigationCase protected instead of private. Then I can 
decorate the NavigationCase.


Ciao,
Mario


Re: NavigationHandlerImpl and viewId

Posted by Adam Winer <aw...@gmail.com>.
On 12/22/05, Martin Marinschek <ma...@gmail.com> wrote:
> This is the comment in viewHandler.createView():
>
> //      as of JSF spec page 7-16:
> //      "It is the callers responsibility to ensure that setViewId() is called
> //      on the returned view, passing the same viewId value."
> //      so we do not set the viewId here
>
> //      ok, but the RI does so, so let's do it, too.
>
> So we do call the viewRoot.setViewId(); in createView, but then call
> it afterwards as well. Which really doesn't make any sense!
>
> I'll get rid of the offending statement - Adam, can you check back if
> there is something unclear in the spec?

The spec text here is *freaky*!  The Javadoc on createView() seems perfectly
clear that the viewId should be set on the UIViewRoot automatically.

I've filed an issue against the spec.

-- Adam

Re: NavigationHandlerImpl and viewId

Posted by Martin Marinschek <ma...@gmail.com>.
This is the comment in viewHandler.createView():

//      as of JSF spec page 7-16:
//      "It is the callers responsibility to ensure that setViewId() is called
//      on the returned view, passing the same viewId value."
//      so we do not set the viewId here

//      ok, but the RI does so, so let's do it, too.

So we do call the viewRoot.setViewId(); in createView, but then call
it afterwards as well. Which really doesn't make any sense!

I'll get rid of the offending statement - Adam, can you check back if
there is something unclear in the spec?

regards,

Martin

On 12/22/05, Adam Winer <aw...@gmail.com> wrote:
> This is very strange code, IMO.  ViewHandler.createView() should
> return a UIViewRoot with the viewId already set;  that last statement
> (viewRoot.setViewId(newViewId)) should be a no-op.
>
> -- Adam
>
> On 12/22/05, Mario Ivankovits <ma...@ops.co.at> wrote:
> > Hi!
> >
> > In NavigationHandlerImpl around line 145 there is the following code
> >
> > ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
> > //create new view
> > String newViewId = navigationCase.getToViewId();
> > UIViewRoot viewRoot = viewHandler.createView(facesContext, newViewId);
> > viewRoot.setViewId(newViewId);
> >
> > now I have a problem with the last statement.
> > My viewHandler create a view with a slightly different viewId. The
> > setViewId(newViewId) cause the browser to view a "requested resource not
> > available" message.
> >
> > If I cange this to:
> >
> > viewRoot.setViewId(viewRoot.getViewId());
> >
> > it works like a charme.
> > If I create a patch, is it possible to have it applied - or is it needed
> > to be RI compliant?
> >
> > If so, I can handle my use case by overloading the NavigationHandler,
> > but then I'll really appreciate if we can make
> > calcMatchingNavigationCase protected instead of private. Then I can
> > decorate the NavigationCase.
> >
> >
> > Ciao,
> > Mario
> >
> >
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: NavigationHandlerImpl and viewId

Posted by Martin Marinschek <ma...@gmail.com>.
party@apache.org?

there is something like this? didn't know that ;)

regards,

Martin

On 12/22/05, Mario Ivankovits <ma...@ops.co.at> wrote:
> Martin Marinschek wrote:
> > That's what I've done.
> >
> Thanks!
>
> Merry Christmas to you all !!
>
> Ciao,
> Mario
>
> BTW: Are you and your fellows subscribed to party@? Maybe we can
> organize meetings in austria/vieanna from time to time in the new year?
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: NavigationHandlerImpl and viewId

Posted by Mario Ivankovits <ma...@ops.co.at>.
Martin Marinschek wrote:
> That's what I've done.
>   
Thanks!

Merry Christmas to you all !!

Ciao,
Mario

BTW: Are you and your fellows subscribed to party@? Maybe we can 
organize meetings in austria/vieanna from time to time in the new year?


Re: NavigationHandlerImpl and viewId

Posted by Martin Marinschek <ma...@gmail.com>.
That's what I've done.

regards,

Martin

On 12/22/05, Mario Ivankovits <ma...@ops.co.at> wrote:
>
> >> viewRoot.setViewId(viewRoot.getViewId());
> >>
> Silly code, indeed, might have too much "Punch" today ;-)
>
> So can we remove the setViewId() at this place at all?
>
> ---
> Mario
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: NavigationHandlerImpl and viewId

Posted by Mario Ivankovits <ma...@ops.co.at>.
>> viewRoot.setViewId(viewRoot.getViewId());
>>     
Silly code, indeed, might have too much "Punch" today ;-)

So can we remove the setViewId() at this place at all?

---
Mario


Re: NavigationHandlerImpl and viewId

Posted by Mario Ivankovits <ma...@ops.co.at>.
Adam Winer wrote:
> This is very strange code, IMO.  ViewHandler.createView() should
> return a UIViewRoot with the viewId already set;  that last statement
> (viewRoot.setViewId(newViewId)) should be a no-op.
>   
Yes, this is exactly what I thought too.

---
Mario


Re: NavigationHandlerImpl and viewId

Posted by Adam Winer <aw...@gmail.com>.
This is very strange code, IMO.  ViewHandler.createView() should
return a UIViewRoot with the viewId already set;  that last statement
(viewRoot.setViewId(newViewId)) should be a no-op.

-- Adam

On 12/22/05, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
> In NavigationHandlerImpl around line 145 there is the following code
>
> ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
> //create new view
> String newViewId = navigationCase.getToViewId();
> UIViewRoot viewRoot = viewHandler.createView(facesContext, newViewId);
> viewRoot.setViewId(newViewId);
>
> now I have a problem with the last statement.
> My viewHandler create a view with a slightly different viewId. The
> setViewId(newViewId) cause the browser to view a "requested resource not
> available" message.
>
> If I cange this to:
>
> viewRoot.setViewId(viewRoot.getViewId());
>
> it works like a charme.
> If I create a patch, is it possible to have it applied - or is it needed
> to be RI compliant?
>
> If so, I can handle my use case by overloading the NavigationHandler,
> but then I'll really appreciate if we can make
> calcMatchingNavigationCase protected instead of private. Then I can
> decorate the NavigationCase.
>
>
> Ciao,
> Mario
>
>