Class AddSOAPFault
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.soap.soap11.profile.impl.AddSOAPFault
-
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction
public class AddSOAPFault extends AbstractProfileAction
Action that resolves or builds a SOAP 1.1Faultobject, 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 isAddSOAPFault.MessageContextFaultStrategy.If no context fault instance is resolved, a new instance will be built using strategy functions which lookup the
FaultCodeQNameand theFaultStringStringvalues. If no value is produced, the former defaults toFaultCode.SERVER. The latter defaults tonull.- Event:
EventIds.PROCEED_EVENT_ID
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAddSOAPFault.FaultCodeMappingFunctionA default method to map event IDs to faultcode QName based onEventContext.static classAddSOAPFault.MessageContextFaultStrategyDefault strategy which returns aFaultinstance already registered in the current request context.
-
Field Summary
Fields Modifier and Type Field Description private Function<ProfileRequestContext,Fault>contextFaultStrategyStrategy for resolving a fault instance directly from the request context.private QNamedefaultFaultCodeDefault fault codes to insert.private booleandetailedErrorsWhether to include detailed status information.private Predicate<ProfileRequestContext>detailedErrorsConditionPredicate determining whether detailed error information is permitted.private Function<ProfileRequestContext,QName>faultCodeLookupStrategyOptional method to obtain fault code.private StringfaultStringA default fault string to include.private Function<ProfileRequestContext,String>faultStringLookupStrategyOptional method to obtain a fault string.private org.slf4j.LoggerlogClass logger.private booleannullifyOutboundMessageWhether to set the outbound message context's message property to null.
-
Constructor Summary
Constructors Constructor Description AddSOAPFault()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbuildFaultString(Fault fault, String message)Build and attachFaultStringelement.private FaultbuildNewMappedFault(ProfileRequestContext profileRequestContext)Build and return a newFaultbased on configured mapping strategy.protected voiddoExecute(ProfileRequestContext profileRequestContext)protected booleandoPreExecute(ProfileRequestContext profileRequestContext)private FaultresolveContextFault(ProfileRequestContext profileRequestContext)Resolve aFaultinstance stored in theProfileRequestContext.voidsetContextFaultStrategy(Function<ProfileRequestContext,Fault> strategy)Set the optional strategy used to resolve aFaultinstance directly from the request context.voidsetDetailedErrorsCondition(Predicate<ProfileRequestContext> condition)Set the predicate used to determine the detailed errors condition.voidsetFaultCode(QName code)Set the default faultcode to insert.voidsetFaultCodeLookupStrategy(Function<ProfileRequestContext,QName> strategy)Set the optional strategy used to obtain a faultcode to include.voidsetFaultString(String message)Set a default faultstring to use in the event that error detail is off, or no specific message is obtained.voidsetFaultStringLookupStrategy(Function<ProfileRequestContext,String> strategy)Set the optional strategy used to obtain a faultstring to include.voidsetNullifyOutboundMessage(boolean flag)Set the flag indicating whether to set the outbound message context's message property to null.-
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, 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.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private org.slf4j.Logger log
Class logger.
-
contextFaultStrategy
@Nullable private Function<ProfileRequestContext,Fault> contextFaultStrategy
Strategy for resolving a fault instance directly from the request context.
-
detailedErrorsCondition
@Nonnull private Predicate<ProfileRequestContext> detailedErrorsCondition
Predicate determining whether detailed error information is permitted.
-
faultCodeLookupStrategy
@Nullable private Function<ProfileRequestContext,QName> faultCodeLookupStrategy
Optional method to obtain fault code.
-
faultStringLookupStrategy
@Nullable private Function<ProfileRequestContext,String> faultStringLookupStrategy
Optional method to obtain a fault string.
-
defaultFaultCode
@Nonnull @NonnullElements private QName defaultFaultCode
Default fault codes to insert.
-
faultString
@Nullable private String faultString
A default fault string to include.
-
detailedErrors
private boolean detailedErrors
Whether to include detailed status information.
-
nullifyOutboundMessage
private boolean nullifyOutboundMessage
Whether to set the outbound message context's message property to null.
-
-
Method Detail
-
setNullifyOutboundMessage
public void setNullifyOutboundMessage(boolean flag)
Set the flag indicating whether to set the outbound message context's message property to null.Default is:
true- Parameters:
flag- true if should nullify, false if not
-
setContextFaultStrategy
public void setContextFaultStrategy(@Nullable Function<ProfileRequestContext,Fault> strategy)Set the optional strategy used to resolve aFaultinstance directly from the request context.- Parameters:
strategy- strategy used to resolve the fault instance
-
setDetailedErrorsCondition
public void setDetailedErrorsCondition(@Nonnull Predicate<ProfileRequestContext> condition)Set the predicate used to determine the detailed errors condition.- Parameters:
condition- predicate for detailed errors condition
-
setFaultCodeLookupStrategy
public void setFaultCodeLookupStrategy(@Nullable Function<ProfileRequestContext,QName> strategy)Set the optional strategy used to obtain a faultcode to include.- Parameters:
strategy- strategy used to obtain faultcode
-
setFaultStringLookupStrategy
public void setFaultStringLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)Set the optional strategy used to obtain a faultstring to include.- Parameters:
strategy- strategy used to obtain a fault string
-
setFaultCode
public void setFaultCode(@Nonnull QName code)Set the default faultcode to insert.- Parameters:
code- faultcode
-
setFaultString
public void setFaultString(@Nullable String message)Set a default faultstring to use in the event that error detail is off, or no specific message is obtained.- Parameters:
message- default faultstring
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doPreExecutein classAbstractProfileAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doExecutein classAbstractProfileAction
-
resolveContextFault
@Nullable private Fault resolveContextFault(ProfileRequestContext profileRequestContext)
Resolve aFaultinstance stored in theProfileRequestContext.- Parameters:
profileRequestContext- the current request context- Returns:
- the fault instance resolved from the request context, or null
-
buildNewMappedFault
@Nonnull private Fault buildNewMappedFault(ProfileRequestContext profileRequestContext)
Build and return a newFaultbased on configured mapping strategy.- Parameters:
profileRequestContext- the current request context- Returns:
- the new fault
-
buildFaultString
private void buildFaultString(@Nonnull Fault fault, @Nonnull @NotEmpty String message)Build and attachFaultStringelement.- Parameters:
fault- the element to attach tomessage- the message to set
-
-