Package org.jboss.errai.bus.client.api.base

Examples of org.jboss.errai.bus.client.api.base.CommandMessage


    }
  };


  public static Message decodeCommandMessage(Object value) {
    CommandMessage msg = CommandMessage.createWithParts(decodePayload(value));
    msg.setResource(RequestDispatcher.class.getName(), requestDispatcherProvider);
    msg.setResource("Session", clientSession);
    return msg;
  }
View Full Code Here


                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, subjects)
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              final CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              StringBuilder capabilitiesBuffer = new StringBuilder(25);

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */
                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());
                msg.set(MessageParts.WebSocketURL, "ws://" + request.getLocalAddr()
                        + ":" + webSocketPort + webSocketPath);

                String connectionToken = SecureHashUtil.nextSecureHash("SHA-256", session.getSessionId());
                session.setAttribute(MessageParts.WebSocketToken.name(), connectionToken);
                msg.set(MessageParts.WebSocketToken, connectionToken);
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here

                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, subjects)
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              StringBuilder capabilitiesBuffer = new StringBuilder();

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */
                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());
                msg.set(MessageParts.WebSocketURL, "ws://" + request.getLocalAddr()
                        + ":" + webSocketPort + webSocketPath);

                String connectionToken = SecureHashUtil.nextSecureHash("SHA-256", session.getSessionId());
                session.setAttribute(MessageParts.WebSocketToken.name(), connectionToken);
                msg.set(MessageParts.WebSocketToken, connectionToken);
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here

    }
  };


  public static Message decodeCommandMessage(Object value) {
    CommandMessage msg = CommandMessage.createWithParts(decodePayload(value));
    msg.setResource(RequestDispatcher.class.getName(), requestDispatcherProvider);
    msg.setResource("Session", clientSession);
    return msg;
  }
View Full Code Here

    }

    consumeEventFromMessage(CommandMessage.createWithParts(messageMap));

    if (isRemoteCommunicationEnabled()) {
      final CommandMessage withParts = CommandMessage.createWithParts(messageMap);
      messageMap.put(MessageParts.ToSubject.name(), SERVER_DISPATCHER_SUBJECT);

      fireOnSubscribe(beanRef.getClass().getName(), withParts);
    }
  }
View Full Code Here

                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, subjects)
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              StringBuilder capabilitiesBuffer = new StringBuilder();

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */
                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());
                msg.set(MessageParts.WebSocketURL, "ws://" + request.getLocalAddr()
                        + ":" + webSocketPort + webSocketPath);

                String connectionToken = SecureHashUtil.nextSecureHash("SHA-256", session.getSessionId());
                session.setAttribute(MessageParts.WebSocketToken.name(), connectionToken);
                msg.set(MessageParts.WebSocketToken, connectionToken);
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here

    }

    consumeEventFromMessage(CommandMessage.createWithParts(messageMap));

    if (isRemoteCommunicationEnabled()) {
      final CommandMessage withParts = CommandMessage.createWithParts(messageMap);
      messageMap.put(MessageParts.ToSubject.name(), SERVER_DISPATCHER_SUBJECT);

      fireOnSubscribe(beanRef.getClass().getName(), withParts);
    }
  }
View Full Code Here

                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, new HashSet(globalSubscriptions))
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              final CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              final StringBuilder capabilitiesBuffer = new StringBuilder(25);

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer || webSocketServlet) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */

                final String webSocketURL;

                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());

                if (webSocketServlet) {
                  webSocketURL = "ws://" + request.getHeader("Host") + webSocketPath;
                }
                else {
                  webSocketURL = "ws://" + request.getLocalName() + ":" + webSocketPort + webSocketPath;
                }
                msg.set(MessageParts.WebSocketURL, webSocketURL);
                msg.set(MessageParts.WebSocketToken, WebSocketTokenManager.getNewOneTimeToken(session));
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here

    }

    consumeEventFromMessage(CommandMessage.createWithParts(messageMap));

    if (isRemoteCommunicationEnabled()) {
      final CommandMessage withParts = CommandMessage.createWithParts(messageMap);
      messageMap.put(MessageParts.ToSubject.name(), SERVER_DISPATCHER_SUBJECT);

      fireOnSubscribe(beanRef.getClass().getName(), withParts);
    }
  }
View Full Code Here

    }
  };


  public static Message decodeCommandMessage(final Object value) {
    final CommandMessage msg = CommandMessage.createWithParts(decodePayload(value));
    msg.setResource(RequestDispatcher.class.getName(), requestDispatcherProvider);
    msg.setResource("Session", clientSession);
    return msg;
  }
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.api.base.CommandMessage

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.