Class SimpAttributesContextHolder
java.lang.Object
org.springframework.messaging.simp.SimpAttributesContextHolder
Holder class to expose SiMP attributes associated with a session (e.g. WebSocket)
 in the form of a thread-bound 
SimpAttributes object.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic SimpAttributesReturn the SimpAttributes currently bound to the thread or raise anIllegalStateExceptionif none are bound.static SimpAttributesReturn the SimpAttributes currently bound to the thread.static voidReset the SimpAttributes for the current thread.static voidsetAttributes(SimpAttributes attributes) Bind the given SimpAttributes to the current thread.static voidsetAttributesFromMessage(Message<?> message) Extract the SiMP session attributes from the given message, wrap them in aSimpAttributesinstance and bind it to the current thread.
- 
Constructor Details- 
SimpAttributesContextHolderpublic SimpAttributesContextHolder()
 
- 
- 
Method Details- 
resetAttributespublic static void resetAttributes()Reset the SimpAttributes for the current thread.
- 
setAttributesBind the given SimpAttributes to the current thread.- Parameters:
- attributes- the RequestAttributes to expose
 
- 
setAttributesFromMessageExtract the SiMP session attributes from the given message, wrap them in aSimpAttributesinstance and bind it to the current thread.- Parameters:
- message- the message to extract session attributes from
 
- 
getAttributesReturn the SimpAttributes currently bound to the thread.- Returns:
- the attributes or nullif not bound
 
- 
currentAttributesReturn the SimpAttributes currently bound to the thread or raise anIllegalStateExceptionif none are bound.- Returns:
- the attributes, never null
- Throws:
- IllegalStateException- if attributes are not bound
 
 
-