org.springframework.messaging.simp.stomp

## Class StompHeaderAccessor

- java.lang.Object
- - org.springframework.messaging.support.MessageHeaderAccessor
  - - org.springframework.messaging.support.NativeMessageHeaderAccessor
    - - org.springframework.messaging.simp.SimpMessageHeaderAccessor
      - - org.springframework.messaging.simp.stomp.StompHeaderAccessor

-     public class StompHeaderAccessor
      extends SimpMessageHeaderAccessor

  Can be used to prepare headers for a new STOMP message, or to access and/or modify STOMP-specific headers of an existing message.

  Use one of the static factory method in this class, then call getters and setters, and at the end if necessary call `NativeMessageHeaderAccessor.toMap()` to obtain the updated headers or call `toNativeHeaderMap()` to obtain only the STOMP-specific headers.

  Since:
    4.0
  Author:
    Rossen Stoyanchev

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `STOMP_ACCEPT_VERSION_HEADER`
    `static String` | `STOMP_ACK_HEADER`
    `static String` | `STOMP_CONTENT_LENGTH_HEADER`
    `static String` | `STOMP_CONTENT_TYPE_HEADER`
    `static String` | `STOMP_DESTINATION_HEADER`
    `static String` | `STOMP_HEARTBEAT_HEADER`
    `static String` | `STOMP_HOST_HEADER`
    `static String` | `STOMP_ID_HEADER`
    `static String` | `STOMP_LOGIN_HEADER`
    `static String` | `STOMP_MESSAGE_HEADER`
    `static String` | `STOMP_MESSAGE_ID_HEADER`
    `static String` | `STOMP_NACK_HEADER`
    `static String` | `STOMP_PASSCODE_HEADER`
    `static String` | `STOMP_RECEIPT_HEADER`
    `static String` | `STOMP_RECEIPT_ID_HEADER`
    `static String` | `STOMP_SUBSCRIPTION_HEADER`
    `static String` | `STOMP_VERSION_HEADER`

    - ### Fields inherited from class org.springframework.messaging.simp.SimpMessageHeaderAccessor

      `CONNECT_MESSAGE_HEADER, DESTINATION_HEADER, MESSAGE_TYPE_HEADER, SESSION_ATTRIBUTES, SESSION_ID_HEADER, SUBSCRIPTION_ID_HEADER, USER_HEADER`

    - ### Fields inherited from class org.springframework.messaging.support.NativeMessageHeaderAccessor

      `NATIVE_HEADERS`

    - ### Fields inherited from class org.springframework.messaging.support.MessageHeaderAccessor

      `logger`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static StompHeaderAccessor` | `create(StompCommand command)` Create `StompHeaderAccessor` for a new `Message`.
    `static StompHeaderAccessor` | `create(StompCommand command, Map<String,List<String>> headers)` Create `StompHeaderAccessor` from parsed STOP frame content.
    `Set<String>` | `getAcceptVersion()`
    `String` | `getAck()`
    `StompCommand` | `getCommand()`
    `Integer` | `getContentLength()`
    `long[]` | `getHeartbeat()`
    `String` | `getHost()`
    `String` | `getLogin()`
    `String` | `getMessage()`
    `String` | `getMessageId()`
    `String` | `getNack()`
    `String` | `getPasscode()`
    `String` | `getReceipt()`
    `String` | `getReceiptId()`
    `String` | `getVersion()`
    `void` | `setAcceptVersion(String acceptVersion)`
    `void` | `setAck(String ack)`
    `void` | `setContentLength(int contentLength)`
    `void` | `setContentType(MimeType contentType)`
    `void` | `setDestination(String destination)`
    `void` | `setHeartbeat(long cx, long cy)`
    `void` | `setHost(String host)`
    `void` | `setLogin(String login)`
    `void` | `setMessage(String content)`
    `void` | `setMessageId(String id)`
    `void` | `setNack(String nack)`
    `void` | `setPasscode(String passcode)`
    `void` | `setReceipt(String receiptId)`
    `void` | `setReceiptId(String receiptId)`
    `void` | `setVersion(String version)`
    `Map<String,List<String>>` | `toNativeHeaderMap()` Return STOMP headers including original, wrapped STOMP headers (if any) plus additional header updates made through accessor methods.
    `Map<String,List<String>>` | `toStompHeaderMap()`
    `StompCommand` | `updateStompCommandAsClientMessage()`
    `void` | `updateStompCommandAsServerMessage()`
    `static StompHeaderAccessor` | `wrap(Message<?> message)` Create `StompHeaderAccessor` from the headers of an existing `Message`.

    - ### Methods inherited from class org.springframework.messaging.simp.SimpMessageHeaderAccessor

      `create, create, getDestination, getMessageType, getSessionAttributes, getSessionId, getSubscriptionId, getUser, setMessageTypeIfNotSet, setSessionAttributes, setSessionId, setSubscriptionId, setUser`

    - ### Methods inherited from class org.springframework.messaging.support.NativeMessageHeaderAccessor

      `addNativeHeader, getFirstNativeHeader, getNativeHeader, isModified, setNativeHeader, toMap`

    - ### Methods inherited from class org.springframework.messaging.support.MessageHeaderAccessor

      `copyHeaders, copyHeadersIfAbsent, getContentType, getErrorChannel, getHeader, getId, getReplyChannel, getTimestamp, isReadOnly, removeHeader, removeHeaders, setErrorChannel, setErrorChannelName, setHeader, setHeaderIfAbsent, setReplyChannel, setReplyChannelName, toString, verifyType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### STOMP_ID_HEADER

          public static final String STOMP_ID_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_HOST_HEADER

          public static final String STOMP_HOST_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_ACCEPT_VERSION_HEADER

          public static final String STOMP_ACCEPT_VERSION_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_MESSAGE_ID_HEADER

          public static final String STOMP_MESSAGE_ID_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_RECEIPT_HEADER

          public static final String STOMP_RECEIPT_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_RECEIPT_ID_HEADER

          public static final String STOMP_RECEIPT_ID_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_SUBSCRIPTION_HEADER

          public static final String STOMP_SUBSCRIPTION_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_VERSION_HEADER

          public static final String STOMP_VERSION_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_MESSAGE_HEADER

          public static final String STOMP_MESSAGE_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_ACK_HEADER

          public static final String STOMP_ACK_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_NACK_HEADER

          public static final String STOMP_NACK_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_LOGIN_HEADER

          public static final String STOMP_LOGIN_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_PASSCODE_HEADER

          public static final String STOMP_PASSCODE_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_DESTINATION_HEADER

          public static final String STOMP_DESTINATION_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_CONTENT_TYPE_HEADER

          public static final String STOMP_CONTENT_TYPE_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_CONTENT_LENGTH_HEADER

          public static final String STOMP_CONTENT_LENGTH_HEADER

      See Also:
        Constant Field Values

    - #### STOMP_HEARTBEAT_HEADER

          public static final String STOMP_HEARTBEAT_HEADER

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### create

          public static StompHeaderAccessor create(StompCommand command)

      Create `StompHeaderAccessor` for a new `Message`.

    - #### create

          public static StompHeaderAccessor create(StompCommand command,
                                                   Map<String,List<String>> headers)

      Create `StompHeaderAccessor` from parsed STOP frame content.

    - #### wrap

          public static StompHeaderAccessor wrap(Message<?> message)

      Create `StompHeaderAccessor` from the headers of an existing `Message`.

    - #### toNativeHeaderMap

          public Map<String,List<String>> toNativeHeaderMap()

      Return STOMP headers including original, wrapped STOMP headers (if any) plus additional header updates made through accessor methods.
      Overrides:
        `toNativeHeaderMap` in class `NativeMessageHeaderAccessor`

    - #### toStompHeaderMap

          public Map<String,List<String>> toStompHeaderMap()

    - #### updateStompCommandAsClientMessage

          public StompCommand updateStompCommandAsClientMessage()

    - #### updateStompCommandAsServerMessage

          public void updateStompCommandAsServerMessage()

    - #### getCommand

          public StompCommand getCommand()

    - #### getAcceptVersion

          public Set<String> getAcceptVersion()

    - #### setAcceptVersion

          public void setAcceptVersion(String acceptVersion)

    - #### setHost

          public void setHost(String host)

    - #### getHost

          public String getHost()

    - #### setDestination

          public void setDestination(String destination)

      Overrides:
        `setDestination` in class `SimpMessageHeaderAccessor`

    - #### getHeartbeat

          public long[] getHeartbeat()

    - #### setContentType

          public void setContentType(MimeType contentType)

      Overrides:
        `setContentType` in class `MessageHeaderAccessor`

    - #### getContentLength

          public Integer getContentLength()

    - #### setContentLength

          public void setContentLength(int contentLength)

    - #### setHeartbeat

          public void setHeartbeat(long cx,
                                   long cy)

    - #### setAck

          public void setAck(String ack)

    - #### getAck

          public String getAck()

    - #### setNack

          public void setNack(String nack)

    - #### getNack

          public String getNack()

    - #### setLogin

          public void setLogin(String login)

    - #### getLogin

          public String getLogin()

    - #### setPasscode

          public void setPasscode(String passcode)

    - #### getPasscode

          public String getPasscode()

    - #### setReceiptId

          public void setReceiptId(String receiptId)

    - #### getReceiptId

          public String getReceiptId()

    - #### setReceipt

          public void setReceipt(String receiptId)

    - #### getReceipt

          public String getReceipt()

    - #### getMessage

          public String getMessage()

    - #### setMessage

          public void setMessage(String content)

    - #### getMessageId

          public String getMessageId()

    - #### setMessageId

          public void setMessageId(String id)

    - #### getVersion

          public String getVersion()

    - #### setVersion

          public void setVersion(String version)