Package org.opensaml.messaging.handler

# Class AbstractHttpServletRequestMessageHandler

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.handler.AbstractMessageHandler
org.opensaml.messaging.handler.AbstractHttpServletRequestMessageHandler

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

Direct Known Subclasses:
  `BaseSAMLSimpleSignatureSecurityHandler`, `HttpServletRequestValidationHandler`, `ReceivedEndpointSecurityHandler`

public abstract class AbstractHttpServletRequestMessageHandler extends AbstractMessageHandler
Base class for message handlers that require access to an `HttpServletRequest`.

Since:
  5.2.0

## 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`
The HttpServletRequest being processed.

## Constructor Summary

Constructors
Constructor
Description
`AbstractHttpServletRequestMessageHandler()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`HttpServletRequest`
`getHttpServletRequest()`
Get the HTTP servlet request being processed.
`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 current HTTP request Supplier.

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

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

### 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.InitializableComponent

`initialize, isInitialized`

## Field Details

### checkDuringInit

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

### httpServletRequestSupplier

@NonnullAfterInit private NonnullSupplier<HttpServletRequest> httpServletRequestSupplier
The HttpServletRequest being processed.

## Constructor Details

### AbstractHttpServletRequestMessageHandler

public AbstractHttpServletRequestMessageHandler()
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

### 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

### getHttpServletRequest

@NonnullAfterInit public HttpServletRequest getHttpServletRequest()
Get the HTTP servlet request being processed.

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

Returns:
  Returns the 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 current HTTP request Supplier.

Parameters:
  `requestSupplier` - Supplier for the current HTTP request

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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