Package org.opensaml.soap.wsaddressing.messaging.impl

# Class AddMessageIDHandler

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.handler.AbstractMessageHandler
org.opensaml.soap.messaging.AbstractHeaderGeneratingMessageHandler
org.opensaml.soap.wsaddressing.messaging.impl.AddMessageIDHandler

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `MessageHandler`

public class AddMessageIDHandler extends AbstractHeaderGeneratingMessageHandler
Handler implementation that adds a wsa:MessageID header to the outbound SOAP envelope.

The value from `WSAddressingContext.getMessageIDURI()` will be used, if present. If not, then the value generated via the locally-configured strategy `getIdentifierGenerationStrategy()` will be used. If neither of those sources are available, then a random "urn:uuid:..." URI value will be generated internally using `UUID`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private IdentifierGenerationStrategy`
`identifierGenerationStrategy`
Strategy for generating identifiers.
`private org.slf4j.Logger`
`log`
Logger.

## Constructor Summary

Constructors
Constructor
Description
`AddMessageIDHandler()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInvoke(MessageContext messageContext)`
Performs the handler logic.
`IdentifierGenerationStrategy`
`getIdentifierGenerationStrategy()`
Get the identifier generation strategy.
`protected String`
`getMessageID(MessageContext messageContext)`
Get the effective message ID value to issue in the outbound message.
`void`
`setIdentifierGenerationStrategy(IdentifierGenerationStrategy strategy)`
Set the identifier generation strategy.

### Methods inherited from class org.opensaml.soap.messaging.AbstractHeaderGeneratingMessageHandler

`decorateGeneratedHeader, doPreInvoke, getEffectiveTargetNode, isEffectiveMustUnderstand, setMustUnderstand, setMustUnderstandStrategy, setTargetNode, setTargetNodeStrategy`

### Methods inherited from class org.opensaml.messaging.handler.AbstractMessageHandler

`doPostInvoke, doPostInvoke, getActivationCondition, getLogPrefix, invoke, isPreInvokeCalled, setActivationCondition`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

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

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

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### log

@Nonnull private org.slf4j.Logger log
Logger.

### identifierGenerationStrategy

@Nullable private IdentifierGenerationStrategy identifierGenerationStrategy
Strategy for generating identifiers.

## Constructor Details

### AddMessageIDHandler

public AddMessageIDHandler()

## Method Details

### getIdentifierGenerationStrategy

@Nullable public IdentifierGenerationStrategy getIdentifierGenerationStrategy()
Get the identifier generation strategy.

Returns:
  the strategy, or null

### setIdentifierGenerationStrategy

public void setIdentifierGenerationStrategy(@Nullable IdentifierGenerationStrategy strategy)
Set the identifier generation strategy.

Parameters:
  `strategy` - the new strategy

### doInvoke

protected void doInvoke(@Nonnull MessageContext messageContext) throws MessageHandlerException
Performs the handler logic.

Specified by:
  `doInvoke` in class `AbstractMessageHandler`
Parameters:
  `messageContext` - the message context on which to invoke the handler
Throws:
  `MessageHandlerException` - if there is an error invoking the handler on the message context

### getMessageID

@Nonnull protected String getMessageID(MessageContext messageContext)
Get the effective message ID value to issue in the outbound message.

Parameters:
  `messageContext` - the current message context
Returns:
  the retrieved or generated message ID