public class AddSOAPFault extends AbstractProfileAction
Fault
object, and stores it in the outbound message context.
An attempt will first be made to resolve a pre-existing fault instance from the ProfileRequestContext
, via
an optionally configured lookup strategy. This is to accommodate SOAP-aware components which may choose to
emit a specific, locally determined fault. The default strategy is AddSOAPFault.MessageContextFaultStrategy
.
If no context fault instance is resolved, a new instance will be built using strategy functions which lookup
the FaultCode
QName
and the FaultString
String
values. If no value is produced,
the former defaults to FaultCode.SERVER
. The latter defaults to null
.
EventIds.PROCEED_EVENT_ID
Modifier and Type | Class and Description |
---|---|
static class |
AddSOAPFault.FaultCodeMappingFunction
A default method to map event IDs to faultcode QName based on
EventContext . |
static class |
AddSOAPFault.MessageContextFaultStrategy
Default strategy which returns a
Fault instance already registered in the current request context. |
Modifier and Type | Field and Description |
---|---|
private Function<ProfileRequestContext,Fault> |
contextFaultStrategy
Strategy for resolving a fault instance directly from the request context.
|
private QName |
defaultFaultCode
Default fault codes to insert.
|
private boolean |
detailedErrors
Whether to include detailed status information.
|
private Predicate<ProfileRequestContext> |
detailedErrorsCondition
Predicate determining whether detailed error information is permitted.
|
private Function<ProfileRequestContext,QName> |
faultCodeLookupStrategy
Optional method to obtain fault code.
|
private String |
faultString
A default fault string to include.
|
private Function<ProfileRequestContext,String> |
faultStringLookupStrategy
Optional method to obtain a fault string.
|
private org.slf4j.Logger |
log
Class logger.
|
private boolean |
nullifyOutboundMessage
Whether to set the outbound message context's message property to null.
|
Constructor and Description |
---|
AddSOAPFault()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
buildFaultString(Fault fault,
String message)
Build and attach
FaultString element. |
private Fault |
buildNewMappedFault(ProfileRequestContext profileRequestContext)
Build and return a new
Fault based on configured mapping strategy. |
protected void |
doExecute(ProfileRequestContext profileRequestContext) |
protected boolean |
doPreExecute(ProfileRequestContext profileRequestContext) |
private Fault |
resolveContextFault(ProfileRequestContext profileRequestContext)
Resolve a
Fault instance stored in the ProfileRequestContext . |
void |
setContextFaultStrategy(Function<ProfileRequestContext,Fault> strategy)
Set the optional strategy used to resolve a
Fault instance directly
from the request context. |
void |
setDetailedErrorsCondition(Predicate<ProfileRequestContext> condition)
Set the predicate used to determine the detailed errors condition.
|
void |
setFaultCode(QName code)
Set the default faultcode to insert.
|
void |
setFaultCodeLookupStrategy(Function<ProfileRequestContext,QName> strategy)
Set the optional strategy used to obtain a faultcode to include.
|
void |
setFaultString(String message)
Set a default faultstring to use in the event that error detail is off,
or no specific message is obtained.
|
void |
setFaultStringLookupStrategy(Function<ProfileRequestContext,String> strategy)
Set the optional strategy used to obtain a faultstring to include.
|
void |
setNullifyOutboundMessage(boolean flag)
Set the flag indicating whether to set the outbound message context's message property to null.
|
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize, isInitialized
@Nonnull private org.slf4j.Logger log
@Nullable private Function<ProfileRequestContext,Fault> contextFaultStrategy
@Nonnull private Predicate<ProfileRequestContext> detailedErrorsCondition
@Nullable private Function<ProfileRequestContext,QName> faultCodeLookupStrategy
@Nullable private Function<ProfileRequestContext,String> faultStringLookupStrategy
@Nonnull @NonnullElements private QName defaultFaultCode
private boolean detailedErrors
private boolean nullifyOutboundMessage
public void setNullifyOutboundMessage(boolean flag)
Default is: true
flag
- true if should nullify, false if notpublic void setContextFaultStrategy(@Nullable Function<ProfileRequestContext,Fault> strategy)
Fault
instance directly
from the request context.strategy
- strategy used to resolve the fault instancepublic void setDetailedErrorsCondition(@Nonnull Predicate<ProfileRequestContext> condition)
condition
- predicate for detailed errors conditionpublic void setFaultCodeLookupStrategy(@Nullable Function<ProfileRequestContext,QName> strategy)
strategy
- strategy used to obtain faultcodepublic void setFaultStringLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)
strategy
- strategy used to obtain a fault stringpublic void setFaultCode(@Nonnull QName code)
code
- faultcodepublic void setFaultString(@Nullable String message)
message
- default faultstringprotected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)
doPreExecute
in class AbstractProfileAction
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)
doExecute
in class AbstractProfileAction
@Nullable private Fault resolveContextFault(ProfileRequestContext profileRequestContext)
Fault
instance stored in the ProfileRequestContext
.profileRequestContext
- the current request context@Nonnull private Fault buildNewMappedFault(ProfileRequestContext profileRequestContext)
Fault
based on configured mapping strategy.profileRequestContext
- the current request contextCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.