class BootstrappedMessages extends UINamingContainer {

    public List<FacesMessage> getFacesMessages() {
        List<FacesMessage> messageList = new ArrayList<>();

        Iterator<FacesMessage> messageItr = getFacesContext().getMessages(null);
        while (messageItr.hasNext()) {
            FacesMessage message = messageItr.next();
            messageList.add(message);
            messageItr.remove();
        }

        return messageList;
    }

}