/** * A constructor for creating message headers from a parsed STOMP frame. */ StompHeaderAccessor(StompCommand command, @Nullable Map<String, List<String>> externalSourceHeaders) { super(command.getMessageType(), externalSourceHeaders); setHeader(COMMAND_HEADER, command); updateSimpMessageHeadersFromStompHeaders(); }
private void protectPasscode() { String value = getFirstNativeHeader(STOMP_PASSCODE_HEADER); if (value != null && !"PROTECTED".equals(value)) { setHeader(CREDENTIALS_HEADER, new StompPasscode(value)); setNativeHeader(STOMP_PASSCODE_HEADER, "PROTECTED"); } }
public StompCommand updateStompCommandAsClientMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if (command == null) { command = StompCommand.SEND; setHeader(COMMAND_HEADER, command); } else if (!command.equals(StompCommand.SEND)) { throw new IllegalStateException("Unexpected STOMP command " + command); } return command; }
public void updateStompCommandAsServerMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if ((command == null) || StompCommand.SEND.equals(command)) { setHeader(COMMAND_HEADER, StompCommand.MESSAGE); } else if (!StompCommand.MESSAGE.equals(command)) { throw new IllegalStateException("Unexpected STOMP command " + command); } trySetStompHeaderForSubscriptionId(); if (getMessageId() == null) { String messageId = getSessionId() + '-' + messageIdCounter.getAndIncrement(); setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId); } }
headerAccessor.setSessionAttributes(session.getAttributes()); headerAccessor.setUser(getUser(session)); headerAccessor.setHeader(SimpMessageHeaderAccessor.HEART_BEAT_HEADER, headerAccessor.getHeartbeat()); if (!detectImmutableMessageInterceptor(outputChannel)) { headerAccessor.setImmutable();
/** * A constructor for creating message headers from a parsed STOMP frame. */ StompHeaderAccessor(StompCommand command, @Nullable Map<String, List<String>> externalSourceHeaders) { super(command.getMessageType(), externalSourceHeaders); setHeader(COMMAND_HEADER, command); updateSimpMessageHeadersFromStompHeaders(); }
public StompCommand updateStompCommandAsClientMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if (command == null) { command = StompCommand.SEND; setHeader(COMMAND_HEADER, command); } else if (!command.equals(StompCommand.SEND)) { throw new IllegalStateException("Unexpected STOMP command " + command); } return command; }
private void protectPasscode() { String value = getFirstNativeHeader(STOMP_PASSCODE_HEADER); if (value != null && !"PROTECTED".equals(value)) { setHeader(CREDENTIALS_HEADER, new StompPasscode(value)); setNativeHeader(STOMP_PASSCODE_HEADER, "PROTECTED"); } }
public void updateStompCommandAsServerMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if ((command == null) || StompCommand.SEND.equals(command)) { setHeader(COMMAND_HEADER, StompCommand.MESSAGE); } else if (!StompCommand.MESSAGE.equals(command)) { throw new IllegalStateException("Unexpected STOMP command " + command); } trySetStompHeaderForSubscriptionId(); if (getMessageId() == null) { String messageId = getSessionId() + '-' + messageIdCounter.getAndIncrement(); setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId); } }
@Bean public ApplicationListener<SessionSubscribeEvent> webSocketEventListener( final AbstractSubscribableChannel clientOutboundChannel) { return event -> { Message<byte[]> message = event.getMessage(); StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.wrap(message); if (stompHeaderAccessor.getReceipt() != null) { stompHeaderAccessor.setHeader("stompCommand", StompCommand.RECEIPT); stompHeaderAccessor.setReceiptId(stompHeaderAccessor.getReceipt()); clientOutboundChannel.send( MessageBuilder.createMessage(new byte[0], stompHeaderAccessor.getMessageHeaders())); } }; }
@Override public void onApplicationEvent(SessionSubscribeEvent event) { Message<byte[]> message = event.getMessage(); StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.wrap(message); if (stompHeaderAccessor.getReceipt() != null) { stompHeaderAccessor.setHeader("stompCommand", StompCommand.RECEIPT); stompHeaderAccessor.setReceiptId(stompHeaderAccessor.getReceipt()); clientOutboundChannel.send( MessageBuilder.createMessage(new byte[0], stompHeaderAccessor.getMessageHeaders())); } }
/** * A constructor for creating message headers from a parsed STOMP frame. */ StompHeaderAccessor(StompCommand command, @Nullable Map<String, List<String>> externalSourceHeaders) { super(command.getMessageType(), externalSourceHeaders); setHeader(COMMAND_HEADER, command); updateSimpMessageHeadersFromStompHeaders(); }
/** * A constructor for creating message headers from a parsed STOMP frame. */ StompHeaderAccessor(StompCommand command, @Nullable Map<String, List<String>> externalSourceHeaders) { super(command.getMessageType(), externalSourceHeaders); setHeader(COMMAND_HEADER, command); updateSimpMessageHeadersFromStompHeaders(); }
private void protectPasscode() { String value = getFirstNativeHeader(STOMP_PASSCODE_HEADER); if (value != null && !"PROTECTED".equals(value)) { setHeader(CREDENTIALS_HEADER, new StompPasscode(value)); setNativeHeader(STOMP_PASSCODE_HEADER, "PROTECTED"); } }
public StompCommand updateStompCommandAsClientMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if (command == null) { command = StompCommand.SEND; setHeader(COMMAND_HEADER, command); } else if (!command.equals(StompCommand.SEND)) { throw new IllegalStateException("Unexpected STOMP command " + command); } return command; }
private void protectPasscode() { String value = getFirstNativeHeader(STOMP_PASSCODE_HEADER); if (value != null && !"PROTECTED".equals(value)) { setHeader(CREDENTIALS_HEADER, new StompPasscode(value)); setNativeHeader(STOMP_PASSCODE_HEADER, "PROTECTED"); } }
public StompCommand updateStompCommandAsClientMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if (command == null) { command = StompCommand.SEND; setHeader(COMMAND_HEADER, command); } else if (!command.equals(StompCommand.SEND)) { throw new IllegalStateException("Unexpected STOMP command " + command); } return command; }
public void updateStompCommandAsServerMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if ((command == null) || StompCommand.SEND.equals(command)) { setHeader(COMMAND_HEADER, StompCommand.MESSAGE); } else if (!StompCommand.MESSAGE.equals(command)) { throw new IllegalStateException("Unexpected STOMP command " + command); } trySetStompHeaderForSubscriptionId(); if (getMessageId() == null) { String messageId = getSessionId() + '-' + messageIdCounter.getAndIncrement(); setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId); } }
public void updateStompCommandAsServerMessage() { SimpMessageType messageType = getMessageType(); if (messageType != SimpMessageType.MESSAGE) { throw new IllegalStateException("Unexpected message type " + messageType); } StompCommand command = getCommand(); if ((command == null) || StompCommand.SEND.equals(command)) { setHeader(COMMAND_HEADER, StompCommand.MESSAGE); } else if (!StompCommand.MESSAGE.equals(command)) { throw new IllegalStateException("Unexpected STOMP command " + command); } trySetStompHeaderForSubscriptionId(); if (getMessageId() == null) { String messageId = getSessionId() + '-' + messageIdCounter.getAndIncrement(); setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId); } }
headerAccessor.setSessionAttributes(session.getAttributes()); headerAccessor.setUser(getUser(session)); headerAccessor.setHeader(SimpMessageHeaderAccessor.HEART_BEAT_HEADER, headerAccessor.getHeartbeat()); if (!detectImmutableMessageInterceptor(outputChannel)) { headerAccessor.setImmutable();