Package org.apache.myfaces.extensions.cdi.message.api

Examples of org.apache.myfaces.extensions.cdi.message.api.MessageContext


    }

    @Test
    public void cloneMessageContextTest()
    {
        MessageContext messageContext = this.messageContext.cloneContext();
        messageContext.message().text("{hello}").create();

        this.messageContext.config().change().addMessageHandler(new TestInMemoryMessageHandler());

        assertFalse(messageContext.config().getMessageHandler().equals(this.messageContext.config().getMessageHandler()));
    }
View Full Code Here


    }

    @Test
    public void customMessageContextTest()
    {
        MessageContext messageContext = new TestCustomMessageContext();

        assertTrue(messageContext.typed(TestCustomMessageContext.class).isReachable());
    }
View Full Code Here

        }
    }

    private static void addViolationsAsMessage(Set<SecurityViolation> violations)
    {
        MessageContext messageContext = getContextualReferenceByClass(
                MessageContext.class, true, JSF_QUALIFIER);

        if(messageContext == null)
        {
            return;
        }

        for(SecurityViolation violation : violations)
        {
            messageContext.message().text(violation.getReason()).payload(MessageSeverity.ERROR).add();
        }
    }
View Full Code Here

        if (!argumentFilterInstance.isUnsatisfied())
        {
            argumentFilter = argumentFilterInstance.get();
        }

        MessageContext result = defaultMessageContext.config()
                .use()
                .localeResolver(new JsfAwareLocaleResolver())
                .messageResolver(new JsfAwareApplicationMessagesMessageResolver())
                .messageInterpolator(new FacesMessageInterpolator(elProvider, argumentFilter))
                .addMessageHandler(new JsfAwareMessageHandler())
                .create();

        if (messageFactory != null)
        {
            return DefaultMessageContext.create(result.config(), messageFactory);
        }

        return result;
    }
View Full Code Here

        }
    }

    private static void addViolationsAsMessage(Set<SecurityViolation> violations)
    {
        MessageContext messageContext = getContextualReferenceByClass(
                MessageContext.class, true, JSF_QUALIFIER);

        if(messageContext == null)
        {
            return;
        }

        for(SecurityViolation violation : violations)
        {
            messageContext.message().text(violation.getReason()).payload(MessageSeverity.ERROR).add();
        }
    }
View Full Code Here

        if (!argumentFilterInstance.isUnsatisfied())
        {
            argumentFilter = argumentFilterInstance.get();
        }

        MessageContext result = defaultMessageContext.config()
                .use()
                    .localeResolver(new JsfAwareLocaleResolver())
                    .messageResolver(new JsfAwareApplicationMessagesMessageResolver())
                    .messageInterpolator(new FacesMessageInterpolator(elProvider, argumentFilter))
                    .addMessageHandler(new JsfAwareMessageHandler())
                .create();

        if (messageFactory != null)
        {
            return DefaultMessageContext.create(result.config(), messageFactory);
        }

        return result;
    }
View Full Code Here

            //here you do what ever you want with exception
            if (businessException != null) {
                try {

                    MessageContext messageContext = CodiUtils.getContextualReferenceByClass(MessageContext.class, DefaultAnnotation.of(Jsf.class));
                    messageContext.message().text(businessException.getMessage()).payload(MessageSeverity.ERROR).add();

                } finally {
                    //remove it from queue
                    i.remove();
                }
View Full Code Here

        }
    }

    private static void addViolationsAsMessage(Set<SecurityViolation> violations)
    {
        MessageContext messageContext = getContextualReferenceByClass(
                MessageContext.class, true, JSF_QUALIFIER);

        if(messageContext == null)
        {
            return;
        }

        for(SecurityViolation violation : violations)
        {
            messageContext.message().text(violation.getReason()).payload(MessageSeverity.ERROR).add();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.message.api.MessageContext

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.