Package javax.faces.application

Examples of javax.faces.application.FacesMessage


      for (Iterator ids = facesContext.getClientIdsWithMessages();
           ids.hasNext();) {
        String id = (String) ids.next();
        for (Iterator messages = facesContext.getMessages(id);
             messages.hasNext();) {
          FacesMessage message = (FacesMessage) messages.next();
          logMessages.add(errorMessageForDebugging(id, message));
        }
      }
      if (!logMessages.isEmpty()) {
        logMessages.add(0, "LOG.show();");
View Full Code Here


            urlConnection.setConnectTimeout(3000);
            urlConnection.setReadTimeout(3000);
            Reader reader = new InputStreamReader(urlConnection.getInputStream());
            SamlExternalEntity samlEntity = spConfigApi.addExternalSamlEntity(reader);

            FacesMessage facesMessage = new FacesMessage("SAML entity " + samlEntity.getEntityId() + " has been added.");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        } catch (MalformedURLException e) {
            FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Malformed URL.", "");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        } catch (IOException e) {
            FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Metadata could not be read.", "");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        }
    }
View Full Code Here

    @Dialogued
    public void login(String idpEntityId) {
        if (!isLoggedIn()) {
            samlSpApi.login(idpEntityId, (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse());
        } else {
            FacesMessage facesMessage = new FacesMessage("Already logged in.");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        }
    }
View Full Code Here

        if (isLoggedIn()) {
            if (samlSpApi.getSession() != null) {
                samlSpApi.localLogout();
            }
        } else {
            FacesMessage facesMessage = new FacesMessage("Not logged in.");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        }
    }
View Full Code Here

        if (isLoggedIn()) {
            if (samlSpApi.getSession() != null) {
                samlSpApi.globalLogout((HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse());
            }
        } else {
            FacesMessage facesMessage = new FacesMessage("Not logged in.");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        }
    }
View Full Code Here

            urlConnection.setConnectTimeout(3000);
            urlConnection.setReadTimeout(3000);
            Reader reader = new InputStreamReader(urlConnection.getInputStream());
            SamlExternalEntity samlEntity = idpConfigApi.addExternalSamlEntity(reader);

            FacesMessage facesMessage = new FacesMessage("SAML entity " + samlEntity.getEntityId() + " has been added.");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        } catch (MalformedURLException e) {
            FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Malformed URL.", "");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        } catch (IOException e) {
            FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Metadata could not be read.", "");
            FacesContext.getCurrentInstance().addMessage(null, facesMessage);
        }
    }
View Full Code Here

    }

    public void register() throws Exception {
        try {
            memberRegistration.register(newMember);
            FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_INFO, (String) messages.registeredMessage(),
                    messages.registerSuccessfulMessage());
            facesContext.addMessage(null, m);
            initNewMember();
        } catch (Exception e) {
            String errorMessage = getRootErrorMessage(e);
            FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, messages.registerFailMessage());
            facesContext.addMessage(null, m);
        }
    }
View Full Code Here

     * or because the guess is not in range.
     *
     */
    public void validateNumberRange(FacesContext context, UIComponent toValidate, Object value) {
        if (remainingGuesses <= 0) {
            FacesMessage message = new FacesMessage("No guesses left!");
            context.addMessage(toValidate.getClientId(context), message);
            ((UIInput) toValidate).setValid(false);
            return;
        }
        int input = (Integer) value;

        if (input < smallest || input > biggest) {
            ((UIInput) toValidate).setValid(false);

            FacesMessage message = new FacesMessage("Invalid guess");
            context.addMessage(toValidate.getClientId(context), message);
        }
    }
View Full Code Here

    public void validate(FacesContext facesContext, UIComponent uiComponent, Object memberIdObject) throws ValidatorException {
        // The id can only contain positive long values.
        try {
            long memberId = (Long) memberIdObject;
        } catch (Exception e) {
            FacesMessage facesMessage = new FacesMessage();
            facesMessage.setSummary("Member Id is not valid.");
            facesMessage.setDetail("Member Id must be an positive number.");
            facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
            facesContext.addMessage("reg:id", facesMessage);
            throw new ValidatorException(facesMessage);
        }
    }
View Full Code Here

        // Convert our Temperature
        if (source.getScale() == CELSIUS) { // Celsius to Fahrenheit
            // Easter egg for Absolute Zero.
            if (source.getTemperature() < Temperature.ABSOLUTE_ZERO_C) {
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Below Absolute Zero!"));
            } else if (source.getTemperature() == Temperature.ABSOLUTE_ZERO_C) {
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Absolute Zero!"));
            }
            return new Temperature((source.getTemperature() * 9 / 5) + 32, FAHRENHEIT);
        } else if (source.getScale() == FAHRENHEIT) { // Fahrenheit to Celsius
            // Easter egg for Absolute Zero.
            if (source.getTemperature() < Temperature.ABSOLUTE_ZERO_F) {
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Below Absolute Zero!"));
            } else if (source.getTemperature() == Temperature.ABSOLUTE_ZERO_F) {
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Absolute Zero!"));
            }
            return new Temperature((source.getTemperature() - 32) * 5 / 9, CELSIUS);
        } else { // Should never get here!
            throw new IllegalStateException("This is embarrassing - this error should NOT occur!");
        }
View Full Code Here

TOP

Related Classes of javax.faces.application.FacesMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.