Class SimpAttributes
java.lang.Object
org.springframework.messaging.simp.SimpAttributes
A wrapper class for access to attributes associated with a SiMP session
 (for example, WebSocket session).
- Since:
- 4.1
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionSimpAttributes(String sessionId, Map<String, Object> attributes) Constructor wrapping the given session attributes map.
- 
Method SummaryModifier and TypeMethodDescriptionstatic SimpAttributesfromMessage(Message<?> message) Extract the SiMP session attributes from the given message and wrap them in aSimpAttributesinstance.getAttribute(String name) Return the value for the attribute of the given name, if any.String[]Retrieve the names of all attributes.Return an id for the associated session.Expose the object to synchronize on for the underlying session.booleanWhether thesessionCompleted()was already invoked.voidregisterDestructionCallback(String name, Runnable callback) Register a callback to execute on destruction of the specified attribute.voidremoveAttribute(String name) Remove the attribute of the given name, if it exists.voidInvoked when the session is completed.voidsetAttribute(String name, Object value) Set the value with the given name replacing an existing value (if any).
- 
Field Details- 
SESSION_MUTEX_NAMEKey for the mutex session attribute.
- 
SESSION_COMPLETED_NAMEKey set after the session is completed.
- 
DESTRUCTION_CALLBACK_NAME_PREFIXPrefix for the name of session attributes used to store destruction callbacks.
 
- 
- 
Constructor Details- 
SimpAttributes
 
- 
- 
Method Details- 
getAttribute
- 
setAttribute
- 
removeAttributeRemove the attribute of the given name, if it exists.Also removes the registered destruction callback for the specified attribute, if any. However it does not execute the callback. It is assumed the removed object will continue to be used and destroyed independently at the appropriate time. - Parameters:
- name- the name of the attribute
 
- 
getAttributeNamesRetrieve the names of all attributes.- Returns:
- the attribute names as String array, never null
 
- 
registerDestructionCallbackRegister a callback to execute on destruction of the specified attribute. The callback is executed when the session is closed.- Parameters:
- name- the name of the attribute to register the callback for
- callback- the destruction callback to be executed
 
- 
getSessionIdReturn an id for the associated session.- Returns:
- the session id as String (never null)
 
- 
getSessionMutexExpose the object to synchronize on for the underlying session.- Returns:
- the session mutex to use (never null)
 
- 
isSessionCompletedpublic boolean isSessionCompleted()Whether thesessionCompleted()was already invoked.
- 
sessionCompletedpublic void sessionCompleted()Invoked when the session is completed. Executed completion callbacks.
- 
fromMessageExtract the SiMP session attributes from the given message and wrap them in aSimpAttributesinstance.- Parameters:
- message- the message to extract session attributes from
 
 
-