use of javax.faces.application.ViewHandler in project acs-community-packaging by Alfresco.
the class BaseActionWizard method goToPage.
/**
* Navigates to the given page, used to go back and forth between the
* wizard and the actions settings pages
*
* @param context FacesContext
* @param viewId The viewId to go to
*/
protected void goToPage(FacesContext context, String viewId) {
ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, viewId);
viewRoot.setViewId(viewId);
context.setViewRoot(viewRoot);
context.renderResponse();
}
use of javax.faces.application.ViewHandler in project acs-community-packaging by Alfresco.
the class AlfrescoFacesPortlet method handleError.
/**
* Handles errors that occur during a render request
*/
private void handleError(RenderRequest request, RenderResponse response, Throwable error) throws PortletException, IOException {
// get the error bean from the session and set the error that occurred.
PortletSession session = request.getPortletSession();
ErrorBean errorBean = (ErrorBean) session.getAttribute(ErrorBean.ERROR_BEAN_NAME, PortletSession.PORTLET_SCOPE);
if (errorBean == null) {
errorBean = new ErrorBean();
session.setAttribute(ErrorBean.ERROR_BEAN_NAME, errorBean, PortletSession.PORTLET_SCOPE);
}
errorBean.setLastError(error);
// if the faces context is available set the current view to the browse page
// so that the error page goes back to the application (rather than going back
// to the same page which just throws the error again meaning we can never leave
// the error page)
FacesContext context = FacesContext.getCurrentInstance();
if (context != null) {
ViewHandler viewHandler = context.getApplication().getViewHandler();
// TODO: configure the portlet error return page
UIViewRoot view = viewHandler.createView(context, FacesHelper.BROWSE_VIEW_ID);
context.setViewRoot(view);
}
// get the error page and include that instead
String errorPage = getErrorPage();
if (logger.isDebugEnabled())
logger.debug("An error has occurred, redirecting to error page: " + errorPage);
response.setContentType("text/html");
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(errorPage);
dispatcher.include(request, response);
}
use of javax.faces.application.ViewHandler in project acs-community-packaging by Alfresco.
the class AlfrescoNavigationHandler method goToView.
/**
* Dispatches to the given view id
*
* @param context Faces context
* @param viewId The view id to go to
*/
private void goToView(FacesContext context, String viewId) {
ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, viewId);
viewRoot.setViewId(viewId);
context.setViewRoot(viewRoot);
context.renderResponse();
}
Aggregations