Refine search
if (event instanceof MenuActionEvent) { FacesContext facesContext = getFacesContext(); ELContext eLContext = facesContext.getELContext(); MenuActionEvent menuActionEvent = (MenuActionEvent) event; MenuItem menuItem = menuActionEvent.getMenuItem(); MethodExpression noArgExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[0]); MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{ActionEvent.class}); MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{MenuActionEvent.class}); String outcome = (invokeResult != null) ? invokeResult.toString() : null; facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, actionExpressionString, outcome);
public void navigate(String fromAction, String outcome) { FacesContext facesContext = FacesContext.getCurrentInstance(); facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, fromAction, outcome); }
String viewId = context.getViewRoot().getViewId(); context.getApplication().getNavigationHandler().handleNavigation(context, viewId, onError); if (!context.getResponseComplete() && !continueToFaces) HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); try
private void applyForward() { FacesContext facesContext = FacesContext.getCurrentInstance(); // Find where to redirect the user. String redirect = getTheFromOutCome(); // Change the Navigation context. NavigationHandler myNav = facesContext.getApplication().getNavigationHandler(); myNav.handleNavigation(facesContext, null, redirect); // Update the view root UIViewRoot vr = facesContext.getViewRoot(); if (vr != null) { // Get the URL where to redirect the user String url = facesContext.getExternalContext().getRequestContextPath(); url = url + "/" + vr.getViewId().replace(".xhtml", ".jsf"); Object obj = facesContext.getExternalContext().getResponse(); if (obj instanceof HttpServletResponse) { HttpServletResponse response = (HttpServletResponse) obj; try { // Redirect the user now. response.sendRedirect(response.encodeURL(url)); } catch (IOException e) { e.printStackTrace(); } } } }
public void handleNavigation(final PhaseEvent event) { FacesContext facesContext = event.getFacesContext(); HttpServletRequest request = ((HttpServletRequest) facesContext.getExternalContext().getRequest()); String navigationCase = (String) request.getAttribute(NavigatingInvocationResultHandler.QUEUED_NAVIGATION); if (navigationCase != null) { request.setAttribute(NavigatingInvocationResultHandler.QUEUED_NAVIGATION, null); NavigationHandler navigationHandler = facesContext.getApplication().getNavigationHandler(); log.debug("Passing queued " + PhaseAction.class.getName() + " result [" + navigationCase + "] to NavigationHandler.handleNavigation()"); navigationHandler.handleNavigation(facesContext, "", navigationCase); } }
@Override public void broadcast(javax.faces.event.FacesEvent event) throws AbortProcessingException { super.broadcast(event); FacesContext context = FacesContext.getCurrentInstance(); String outcome = null; MethodExpression me = null; DataTable table = RowEditorRenderer.findParentTable(context, this); RowState state = (RowState)(context.getExternalContext().getRequestMap().get(table.getRowStateVar())); if (event instanceof RowEditEvent) me = getRowEditListener(); else if (event instanceof RowEditCancelEvent) me = getRowEditCancelListener(); if (me != null) outcome = (String) me.invoke(context.getELContext(), new Object[] {event}); if (outcome != null) { NavigationHandler navHandler = context.getApplication().getNavigationHandler(); navHandler.handleNavigation(context, null, outcome); context.renderResponse(); } }
HttpServletRequest httpRequest = (HttpServletRequest) context.getExternalContext().getRequest(); try { MethodExpression method = context.getApplication() .getExpressionFactory().createMethodExpression( context.getELContext(), TagUtils.makeELExpression( u.getActionBinding().getAction()), Object navRules = method.invoke(context.getELContext(), param); NavigationHandler navigation = context.getApplication().getNavigationHandler(); navigation.handleNavigation(context, "", u.getViewId()); } else if (navRules != null && navRules instanceof String) { navigation.handleNavigation(context, "", (String) navRules); } else { throw new ConfigException("une chaine de caractere pour la redirection "
logger.debug("------------------- Handle Exception from facelets -------------------"); if (context.getViewRoot().getViewId().indexOf("exception.xhtml") > -1) { context.getExternalContext().getSessionMap() .put("javax.servlet.error.exception", ex); if (context.getExternalContext().getRequestMap() .get(Bridge.PORTLET_LIFECYCLE_PHASE) != null) { ExternalContext externalContext = context.getExternalContext(); PortletRequest request = (PortletRequest) externalContext .getRequest(); ContextUtils.bindRequestAndContext(request, (PortletContext) externalContext.getContext()); NavigationHandler navigation = context.getApplication() .getNavigationHandler(); navigation.handleNavigation(context, "", exceptionService.getExceptionView());
/** * Perform the navigation to the @AccessDeniedView. If not @AccessDeniedView is defined, return a 401 response * * @param context * @param viewRoot */ private void redirectToAccessDeniedView(FacesContext context, UIViewRoot viewRoot) { AccessDeniedView accessDeniedView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), AccessDeniedView.class); if (accessDeniedView == null || accessDeniedView.value() == null || accessDeniedView.value().isEmpty()) { log.debug("Returning 401 response (access denied)"); context.getExternalContext().setResponseStatus(401); context.responseComplete(); return; } String accessDeniedViewId = accessDeniedView.value(); log.debugf("Redirecting to configured AccessDenied %s", accessDeniedViewId); NavigationHandler navHandler = context.getApplication().getNavigationHandler(); navHandler.handleNavigation(context, "", accessDeniedViewId); context.renderResponse(); }
if (result != null) mu.saveMessages(context, context.getExternalContext().getSessionMap()); String outcome = result.toString(); if (!"".equals(outcome)) NavigationHandler handler = context.getApplication().getNavigationHandler(); handler.handleNavigation(context, prettyContext.getCurrentViewId(), outcome);
/** * @param context * @param e * @throws Throwable */ private void goToErrorPage(FacesContext context, Throwable e) { HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); request.setAttribute(ERROR_EXCEPTION + "_stacktrace", e); if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { throw new FacesException(e); } if (e instanceof FileNotFoundException) { logger.log(Level.WARNING,"File not found", e); throw new FacesException(e); } request.setAttribute(ERROR_EXCEPTION_TYPE, e.getClass().getName()); request.setAttribute(ERROR_MESSAGE, e.getMessage()); request.setAttribute(ERROR_REQUEST_URI, request.getHeader("Referer")); request.setAttribute(ERROR_STATUS_CODE, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); String errorPage = findErrorPage(e); if (!has(errorPage)) { String errorPageParam = context.getExternalContext().getInitParameter(Constants.InitialParams.ERROR_PAGE); if (!has(errorPageParam)) { errorPage = Constants.DEFAULT_ERROR_PAGE; } } context.getApplication().getNavigationHandler().handleNavigation(context, null, errorPage); context.renderResponse(); }
@Override public void navigate(FacesContext facesContext, String fromAction, String outcome) { Application application = facesContext.getApplication(); NavigationHandler navigationHandler = application.getNavigationHandler(); navigationHandler.handleNavigation(facesContext, fromAction, outcome); }
context.getExternalContext().getRequestMap().get(Constants.CONTEXT_BEAN); String prefix = prefix(context); if (dcontext == null) { context.getApplication().getVariableResolver(). resolveVariable(context, Constants.MANAGER_BEAN); dcontext = + "' for FacesContext instance '" + context + "' with navigation to viewId '" + context.getViewRoot().getViewId() + "'"); original.handleNavigation(context, fromAction, outcome); return; + dcontext.getName() + "' for FacesContext '" + context + "' with navigation to viewId '" + context.getViewRoot().getViewId() + "'");
@Override public void broadcast(FacesEvent event) throws AbortProcessingException { super.broadcast(event); FacesContext context = FacesContext.getCurrentInstance(); String outcome = null; MethodExpression me = null; if (event instanceof ListSelectEvent) me = getSelectionListener(); if (me != null) { if (!context.isValidationFailed()) { outcome = (String) me.invoke(context.getELContext(), new Object[] {event}); } if (outcome != null) { NavigationHandler navHandler = context.getApplication().getNavigationHandler(); navHandler.handleNavigation(context, null, outcome); context.renderResponse(); } } }
if (context.getResponseComplete()) context.getApplication().getNavigationHandler().handleNavigation(context, result.getFromAction(), result.getOutcome()); if (context.getResponseComplete()) context.getExternalContext().getRequestMap().remove(BridgeImpl.REDIRECT_VIEWPARAMS); context.getExternalContext().getSessionMap().remove(BridgeImpl.RENDER_REDIRECT_VIEWPARAMS); context.getExternalContext().getSessionMap().remove(BridgeImpl.RENDER_REDIRECT_PRPMAP); context.release();
context.getApplication().getNavigationHandler().handleNavigation(context, null, actionResult); String actionUrl = context.getApplication().getViewHandler().getActionURL( context, getRedirectTo()); String encodedActionUrl = context.getExternalContext().encodeActionURL(actionUrl); context.getExternalContext().redirect(encodedActionUrl);
String oldViewId = facesContext.getViewRoot().getViewId(); String fromAction = eventNavigationResult.getFromAction(); String outcome = eventNavigationResult.getOutcome(); logger.debug("Invoking navigationHandler fromAction=[{0}] outcome=[{1}]", fromAction, outcome); NavigationHandler navigationHandler = facesContext.getApplication().getNavigationHandler(); navigationHandler.handleNavigation(facesContext, fromAction, outcome); String newViewId = facesContext.getViewRoot().getViewId(); bridgeRequestScope.setNavigationOccurred(!oldViewId.equals(newViewId));
@Override protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { final LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); final Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); final FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); final FacesContext facesContext = fcFactory.getFacesContext(getServletContext(), request, response, lifecycle); try { // invoke application final String outcome = invokeApplication(facesContext); if (facesContext.getResponseComplete()) { return; } if (LOG.isDebugEnabled()) { LOG.debug("outcome = '" + outcome + "'"); } final Application application = facesContext.getApplication(); if (facesContext.getViewRoot() == null) { facesContext.setViewRoot(createViewRoot(facesContext)); } final NavigationHandler navigationHandler = application.getNavigationHandler(); navigationHandler.handleNavigation(facesContext, null, outcome); lifecycle.render(facesContext); } finally { facesContext.release(); } }
/** * Handle the navigation * * @param context * The Faces context. * @param fromAction * The action string that triggered the action. * @param outcome * The logical outcome string, which is the new tool mode, or if null, the mode does not change. */ public void handleNavigation(FacesContext context, String fromAction, String outcome) { m_chain.handleNavigation(context, fromAction, outcome); // if we have a redirect scheduled, we need to preserve the messages // if we are coming from the Sakai RequestFilter, and a redirect was requested, the request object // will have this attribute set. HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); if (req.getAttribute("sakai.redirect") != null) { // save messages from the context for restoration on the next rendering MessageSaver.saveMessages(context); } } }
private void processFacesNavigation(final FacesContext context, final String fromAction, final String outcome) { PrettyContext prettyContext = PrettyContext.getCurrentInstance(context); log.debug("Not a PrettyFaces navigation string - passing control to default nav-handler"); prettyContext.setInNavigation(true); String originalViewId = context.getViewRoot().getViewId(); parent.handleNavigation(context, fromAction, outcome); String newViewId = context.getViewRoot().getViewId(); if ((true == context.getResponseComplete()) || (originalViewId.equals(newViewId))) { // Navigation is complete if the viewId has not changed or the // response is complete prettyContext.setInNavigation(false); } }