Refine search
public static void addWarningMessage(String message) { FacesContext.getCurrentInstance().getExternalContext().getFlash().put("warningMsg", message); } public void addMessage( FacesMessage.Severity s, String summary, String details ) {
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#get(Object)} on the wrapped {@link Flash} * object.</p> * * @since 2.2 */ @Override public Object get(Object key) { return getWrapped().get(key); }
public static void redirectToPage(String viewId) { FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true); String requestContextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath(); String fullRedirectUrl = requestContextPath + "/" + viewId; try { System.out.println("Redirecting to " + fullRedirectUrl); FacesContext.getCurrentInstance().getExternalContext().redirect(fullRedirectUrl); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
Flash flash = facesContext.getExternalContext().getFlash(); if(flash.containsKey(ContextNotActiveException.class.getName())) if(facesContext.getViewRoot() != null) viewId = facesContext.getViewRoot().getViewId(); exceptionQueuedEventIterator.remove(); Flash flash = facesContext.getExternalContext().getFlash(); flash.put(throwable.getClass().getName(), throwable); flash.keep(throwable.getClass().getName());
public static void saveFacesMessages(ExternalContext externalContext) { JsfModuleConfig jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class); if (!jsfModuleConfig.isAlwaysKeepMessages()) { return; } try { WindowMetaData windowMetaData = BeanProvider.getContextualReference(WindowMetaData.class); Map<String, Object> requestMap = externalContext.getRequestMap(); @SuppressWarnings({ "unchecked" }) List<FacesMessageEntry> facesMessageEntryList = (List<FacesMessageEntry>)requestMap.get(FacesMessageEntry.class.getName()); if (facesMessageEntryList == null) { facesMessageEntryList = new CopyOnWriteArrayList<FacesMessageEntry>(); } windowMetaData.setFacesMessageEntryList(facesMessageEntryList); } catch (ContextNotActiveException e) { //TODO log it in case of project-stage development //we can't handle it correctly -> delegate to the jsf-api (which has some restrictions esp. before v2.2) FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true); } }
throws IOException if(FacesContext.getCurrentInstance().getResponseComplete()) if(this.useWindowAwareUrlEncoding || this.useFallback || FacesContext.getCurrentInstance().getPartialViewContext().isPartialRequest()) externalContext.getRequestMap().put(WINDOW_CONTEXT_ID_PARAMETER_KEY, windowId); externalContext.getFlash().keep(WINDOW_CONTEXT_ID_PARAMETER_KEY); externalContext.redirect(url);
/** * @see Faces#redirectPermanent(String, String...) */ public static void redirectPermanent(FacesContext context, String url, String... paramValues) { ExternalContext externalContext = context.getExternalContext(); externalContext.getFlash().setRedirect(true); // MyFaces also requires this for a redirect in current request (which is incorrect). externalContext.setResponseStatus(SC_MOVED_PERMANENTLY); externalContext.setResponseHeader("Location", prepareRedirectURL(getRequest(context), url, paramValues)); externalContext.setResponseHeader("Connection", "close"); context.responseComplete(); }
/** * @see Faces#redirect(String, String...) */ public static void redirect(FacesContext context, String url, String... paramValues) { ExternalContext externalContext = context.getExternalContext(); externalContext.getFlash().setRedirect(true); // MyFaces also requires this for a redirect in current request (which is incorrect). try { externalContext.redirect(prepareRedirectURL(getRequest(context), url, paramValues)); } catch (IOException e) { throw new UncheckedIOException(e); } }
Flash flash = context.getExternalContext().getFlash(); flash.doPrePhaseActions(context); } catch (UnsupportedOperationException uoe) { if (LOGGER.isLoggable(Level.FINE)) {
FacesContext facesContext = FacesContext.getCurrentInstance(); Flash flash = getCurrentInstance().getExternalContext().getFlash(); flash.setKeepMessages(true); facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "yourMessage", null)); return "namePage?faces-redirect=true";
private void doLastPhaseActions(FacesContext context, boolean outgoingResponseIsRedirect) { Map<Object, Object> attrs = context.getAttributes(); try { attrs.put(ELFlash.ACT_AS_DO_LAST_PHASE_ACTIONS, outgoingResponseIsRedirect); getFlash().doPostPhaseActions(context); } finally { attrs.remove(ELFlash.ACT_AS_DO_LAST_PHASE_ACTIONS); } }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#put} on the wrapped * {@link Flash} object.</p> * * @since 2.2 */ @Override public Object put(String key, Object value) { return getWrapped().put(key, value); }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#setKeepMessages(boolean)} on the wrapped * {@link Flash} object.</p> * * @since 2.2 */ @Override public void setKeepMessages(boolean newValue) { getWrapped().setKeepMessages(newValue); }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#keep(String)} on the wrapped {@link Flash} * object.</p> * * @since 2.2 */ @Override public void keep(String key) { getWrapped().keep(key); }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#doPrePhaseActions(FacesContext)} on the * wrapped {@link Flash} object.</p> * * @since 2.2 */ @Override public void doPrePhaseActions(FacesContext ctx) { getWrapped().doPrePhaseActions(ctx); }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#containsKey(Object)} on the wrapped * {@link Flash} object.</p> * * @since 2.2 */ @Override public boolean containsKey(Object key) { return getWrapped().containsKey(key); }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#keySet()} on the wrapped {@link Flash} * object.</p> * * @since 2.2 */ @Override public Set<String> keySet() { return getWrapped().keySet(); }
/** * <p class="changed_added_2_2">The default behavior of this method * is to call {@link Flash#setRedirect(boolean)} on the wrapped * {@link Flash} object.</p> * * @since 2.2 */ @Override public void setRedirect(boolean newValue) { getWrapped().setRedirect(newValue); }
@Override public void doPostPhaseActions(FacesContext context) { getWrapped().doPostPhaseActions(context); }