Package org.opensaml.messaging.decoder.servlet

# Class BaseHttpServletRequestXMLMessageDecoder

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.decoder.AbstractMessageDecoder
org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder
org.opensaml.messaging.decoder.servlet.BaseHttpServletRequestXMLMessageDecoder

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `UnmodifiableComponent`, `MessageDecoder`, `HttpServletRequestMessageDecoder`

Direct Known Subclasses:
  `BaseSAMLHttpServletRequestDecoder`, `HTTPSOAP11Decoder`

public abstract class BaseHttpServletRequestXMLMessageDecoder extends AbstractHttpServletRequestMessageDecoder
Base class for message decoders which decode XML messages from an `HttpServletRequest`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Class logger.
`private ParserPool`
`parserPool`
Parser pool used to deserialize the message.

### Fields inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder

`BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY`

## Constructor Summary

Constructors
Constructor
Description
`BaseHttpServletRequestXMLMessageDecoder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`decode()`
Decode message data from the source and store it so that it may be retrieved via `MessageDecoder.getMessageContext()`.
`protected void`
`doInitialize()`
`ParserPool`
`getParserPool()`
Gets the parser pool used to deserialize incoming messages.
`protected String`
`serializeMessageForLogging(Object message)`
Serialize the message for logging purposes.
`void`
`setParserPool(ParserPool pool)`
Sets the parser pool used to deserialize incoming messages.
`protected XMLObject`
`unmarshallMessage(InputStream messageStream)`
Helper method that deserializes and unmarshalls the message from the given stream.
`protected void`
`validateHttpRequest(HttpServletRequest request)`
Perform optional validation of the inbound `HttpServletRequest`.

### Methods inherited from class org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder

`getHttpServletRequest, getHttpServletRequestSupplier, isCheckDuringInit, setCheckDuringInit, setHttpServletRequestSupplier`

### Methods inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder

`doDecode, getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logDecodedMessage, setMessageContext, setProtocolMessageLoggerSubCategory`

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

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, 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.DestructableComponent

`destroy, isDestroyed`

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

`initialize, isInitialized`

### Methods inherited from interface org.opensaml.messaging.decoder.MessageDecoder

`getMessageContext`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### parserPool

@NonnullAfterInit private ParserPool parserPool
Parser pool used to deserialize the message.

## Constructor Details

### BaseHttpServletRequestXMLMessageDecoder

public BaseHttpServletRequestXMLMessageDecoder()
Constructor.

## Method Details

### decode

public void decode() throws MessageDecodingException
Decode message data from the source and store it so that it may be retrieved via `MessageDecoder.getMessageContext()`.

Specified by:
  `decode` in interface `MessageDecoder`
Overrides:
  `decode` in class `AbstractMessageDecoder`
Throws:
  `MessageDecodingException` - if there is a problem decoding the message context

### getParserPool

@NonnullAfterInit public ParserPool getParserPool()
Gets the parser pool used to deserialize incoming messages.

Returns:
  parser pool used to deserialize incoming messages

### setParserPool

public void setParserPool(@Nonnull ParserPool pool)
Sets the parser pool used to deserialize incoming messages.

Parameters:
  `pool` - parser pool used to deserialize incoming messages

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractHttpServletRequestMessageDecoder`
Throws:
  `ComponentInitializationException`

### serializeMessageForLogging

@Nullable protected String serializeMessageForLogging(@Nullable Object message)
Serialize the message for logging purposes.

Default implementation is to return the message object's `Object.toString()`, but subclasses should override if a better message-specific serialization mechanism exists.

Overrides:
  `serializeMessageForLogging` in class `AbstractMessageDecoder`
Parameters:
  `message` - the message to serialize
Returns:
  the serialized message, or null if message can not be serialized

### unmarshallMessage

protected XMLObject unmarshallMessage(@Nonnull InputStream messageStream) throws MessageDecodingException
Helper method that deserializes and unmarshalls the message from the given stream.

Parameters:
  `messageStream` - input stream containing the message
Returns:
  the inbound message
Throws:
  `MessageDecodingException` - thrown if there is a problem deserializing and unmarshalling the message

### validateHttpRequest

protected void validateHttpRequest(@Nonnull HttpServletRequest request) throws MessageDecodingException
Perform optional validation of the inbound `HttpServletRequest`.

This method is called before the main `MessageDecoder.decode()` logic}.

The default behavior is a no-op. Subclasses may override with specific constraints.

Parameters:
  `request` - the HTTP request being validate
Throws:
  `MessageDecodingException` - if request is not considered valid