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
>