Hi This problem was discussed long time ago between 2.0 and 2.1. MyFaces makes a proper distinction between the viewId after is taken from the request url (physical viewId) and the one that points to the logical resource. In my opinion, Mojarra behavior is not valid according to the spec, but it is too hard to convince them to make it right. After all, my only concern is make MyFaces strict compliant with the spec.
To get the right viewId, pass it to ViewHandler.deriveViewId(...) (since 2.0) or to ViewHandler.deriveLogicalViewId(...) (since 2.1), which converts the viewId but does not check if the viewId exists or not (if does not exists return null). In that way, the code will work well with both implementations. regards, Leonardo Uribe 2013/12/22 Thomas Andraschko <[email protected]>: > Ahh i found the issue. I "calculate" the viewId via: > > protected String calculateViewId(FacesContext context) { > Map<String, Object> requestMap = > context.getExternalContext().getRequestMap(); > String viewId = (String) > requestMap.get("javax.servlet.include.path_info"); > > if (viewId == null) { > viewId = context.getExternalContext().getRequestPathInfo(); > } > > if (viewId == null) { > viewId = (String) > requestMap.get("javax.servlet.include.servlet_path"); > } > > if (viewId == null) { > viewId = context.getExternalContext().getRequestServletPath(); > } > > return viewId; > } > > This returns e.g. test.jsf but the file name is actually test.xhtml. > If i pass test.jsf, it only works in Mojarra. If i pass test.xhtml, it works > fine in MyFaces too. > > Should MyFaces support test.jsf? > > > > 2013/12/22 Thomas Andraschko <[email protected]> >> >> Hi, >> >> i'm currently bulding a custom ExceptionHandler. >> If a ViewExpired occured, i try to rebuild the view via: >> >> ViewDeclarationLanguageFactory vdlf = >> (ViewDeclarationLanguageFactory) >> >> FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY); >> ViewDeclarationLanguage vdl = >> vdlf.getViewDeclarationLanguage(viewId); >> >> UIViewRoot viewRoot = vdl.createView(context, viewId); >> context.setViewRoot(viewRoot); >> >> vdl.buildView(context, viewRoot); >> >> After bulding the view, i try to find a component in the view via a >> VisitCallback. >> Somehow, the builded ViewRoot does not have any children (childCount == >> 0). >> This works fine in Mojarra. >> >> For testing, i just open a page, restart jetty and click on ajax button. >> >> Any idea? Leo? >> >> Regards, >> Thomas > >
