Package org.jboss.errai.bus.client

Examples of org.jboss.errai.bus.client.ConversationMessage


            /**
             * Prepare to send a message back to the client, informing it that a successful login has
             * been performed.
             */
            ConversationMessage successfulMsg = ConversationMessage.create(message)
                    .command(SecurityCommands.SuccessfulAuth)
                    .toSubject("LoginClient")
                    .set(SecurityParts.Roles, authSubject.toRolesString())
                    .set(SecurityParts.Name, name);

            try {
                ResourceBundle bundle = ResourceBundle.getBundle("errai");
                String motdText = bundle.getString("errai.login_motd");

                /**
                 * If the MOTD is configured, then add it to the message.
                 */
                if (motdText != null) {
                    successfulMsg.set(MessageParts.MessageText, motdText);
                }
            }
            catch (Exception e) {
                // do nothing.
            }

            /**
             * Transmit the message back to the client.
             */
            successfulMsg.sendNowWith(bus);
        }
        catch (LoginException e) {
            /**
             * The login failed. How upsetting. Life must go on, and we must inform the client of the
             * unfortunate news.
View Full Code Here


        bus.subscribe("ClientNegotiationService", new MessageCallback() {
            public void callback(CommandMessage message) {
                AuthSubject subject = (AuthSubject)
                        ((HttpSession) message.getResource("Session")).getAttribute(ErraiService.SESSION_AUTH_DATA);

                ConversationMessage reply = ConversationMessage.create(message);

                if (subject != null) {
                    reply.set(SecurityParts.Roles, subject.toRolesString());
                    reply.set(SecurityParts.Name, subject.getUsername());
                }

                reply.sendNowWith(bus);
            }
        });

        configurator.configure();
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.ConversationMessage

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.