Package org.opensaml.messaging.decoder.servlet

# Class AbstractHttpServletRequestMessageDecoder

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

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

Direct Known Subclasses:
  `BaseHttpServletRequestXMLMessageDecoder`

public abstract class AbstractHttpServletRequestMessageDecoder extends AbstractMessageDecoder implements HttpServletRequestMessageDecoder
Abstract implementation of `HttpServletRequestMessageDecoder`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`checkDuringInit`
Flag for whether to check for servlet request during init.
`private NonnullSupplier<HttpServletRequest>`
`httpServletRequestSupplier`
Current HTTP request, if available.

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

`BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY`

## Constructor Summary

Constructors
Constructor
Description
`AbstractHttpServletRequestMessageDecoder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`HttpServletRequest`
`getHttpServletRequest()`
Get the HTTP servlet request on which to operate.
`NonnullSupplier<HttpServletRequest>`
`getHttpServletRequestSupplier()`
Get the supplier for HTTP request if available.
`boolean`
`isCheckDuringInit()`
Get whether {`AbstractInitializableComponent.initialize()` should throw an exception if `getHttpServletRequest()` returns null.
`void`
`setCheckDuringInit(boolean flag)`
Set whether {`AbstractInitializableComponent.initialize()` should throw an exception if `getHttpServletRequest()` returns null.
`void`
`setHttpServletRequestSupplier(NonnullSupplier<HttpServletRequest> requestSupplier)`
Set the supplier for the HTTP servlet request on which to operate.

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

`decode, doDecode, getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logDecodedMessage, serializeMessageForLogging, 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

`decode, getMessageContext`

## Field Details

### checkDuringInit

private boolean checkDuringInit
Flag for whether to check for servlet request during init.

### httpServletRequestSupplier

@NonnullAfterInit private NonnullSupplier<HttpServletRequest> httpServletRequestSupplier
Current HTTP request, if available.

## Constructor Details

### AbstractHttpServletRequestMessageDecoder

public AbstractHttpServletRequestMessageDecoder()
Constructor.

## Method Details

### isCheckDuringInit

public boolean isCheckDuringInit()
Get whether {`AbstractInitializableComponent.initialize()` should throw an exception if `getHttpServletRequest()` returns null.

Returns:
  whether a null request should fail initialization
Since:
  5.2.0

### setCheckDuringInit

public void setCheckDuringInit(boolean flag)
Set whether {`AbstractInitializableComponent.initialize()` should throw an exception if `getHttpServletRequest()` returns null.

Defaults to true.

Parameters:
  `flag` - flag to set
Since:
  5.2.0

### getHttpServletRequest

@NonnullAfterInit public HttpServletRequest getHttpServletRequest()
Get the HTTP servlet request on which to operate.

The return annotation is valid only in the default state, when `isCheckDuringInit()` is true.

Specified by:
  `getHttpServletRequest` in interface `HttpServletRequestMessageDecoder`
Returns:
  the HTTP servlet request

### getHttpServletRequestSupplier

@NonnullAfterInit public NonnullSupplier<HttpServletRequest> getHttpServletRequestSupplier()
Get the supplier for HTTP request if available.

The return annotation is valid only in the default state, when `isCheckDuringInit()` is true.

Returns:
  current HTTP request

### setHttpServletRequestSupplier

public void setHttpServletRequestSupplier(@Nullable NonnullSupplier<HttpServletRequest> requestSupplier)
Set the supplier for the HTTP servlet request on which to operate.

Specified by:
  `setHttpServletRequestSupplier` in interface `HttpServletRequestMessageDecoder`
Parameters:
  `requestSupplier` - the HTTP servlet request

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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