Package org.opensaml.messaging.context
Class MessageContext
java.lang.Object
org.opensaml.messaging.context.BaseContext
org.opensaml.messaging.context.MessageContext
- All Implemented Interfaces:
Iterable<BaseContext>
A context component which holds the state related to the processing of a single message.
Additional information associated with the message represented by the context may be held by the context as subordinate subcontext instances. Subcontext instances may simply hold state information related to the message, in which case they may be seen as a type-safe variant of the ubiquitous properties map pattern. They may also be more functional or operational in nature, for example providing "views" onto the message and/or message context data.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext
BaseContext.ContextSetNoRemoveIteratorDecorator, BaseContext.DeprecatedContextClassNameLookAside -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the message represented by the message context, raising aConstraintViolationExceptionif null.<T> TensureMessage(Class<T> claz) Get the message represented by the message context, raising aConstraintViolationExceptionorClassCastExceptionif the message is absent or of the incorrect type.Get the message represented by the message context.voidsetMessage(Object message) Set the message represented by the message context.Methods inherited from class org.opensaml.messaging.context.BaseContext
addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, ensureSubcontext, ensureSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeFromParent, removeSubcontext, removeSubcontext, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
msg
The message represented.
-
-
Constructor Details
-
MessageContext
public MessageContext()
-
-
Method Details
-
getMessage
Get the message represented by the message context.- Returns:
- the message or null
-
ensureMessage
Get the message represented by the message context, raising aConstraintViolationExceptionif null.- Returns:
- the message
- Since:
- 5.0.0
-
ensureMessage
Get the message represented by the message context, raising aConstraintViolationExceptionorClassCastExceptionif the message is absent or of the incorrect type.- Type Parameters:
T- type of message- Parameters:
claz- class of message type- Returns:
- properly typed message
- Since:
- 5.0.0
-
setMessage
Set the message represented by the message context.- Parameters:
message- the message
-