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

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


                      .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

    }

    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

    }

    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

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.