Class BasicHttpServletRequestContentTypeValidator
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.servlet.impl.BasicHttpServletRequestContentTypeValidator
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,HttpServletRequestValidator
public class BasicHttpServletRequestContentTypeValidator
extends AbstractInitializableComponent
implements HttpServletRequestValidator
Component that validates the HTTP content type as one of an allowed set.
Optionally allows for no type to be specified.
- Since:
- 9.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionAllowed parameters.private booleanWhether an absent content type is allowed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the allowed types.booleanGets whether to allow an absent content type.voidsetAllowedContentTypes(Collection<String> types) Set the allowed types.voidsetAllowNullContentType(boolean flag) Sets whether to allow an absent content type.voidvalidate(HttpServletRequest request) Validate the request.Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
allowedContentTypes
Allowed parameters. -
allowNullContentType
private boolean allowNullContentTypeWhether an absent content type is allowed.
-
-
Constructor Details
-
BasicHttpServletRequestContentTypeValidator
public BasicHttpServletRequestContentTypeValidator()Constructor.
-
-
Method Details
-
getAllowedContentTypes
Get the allowed types.- Returns:
- the allowed types
-
setAllowedContentTypes
Set the allowed types.- Parameters:
types- the allowed types
-
getAllowNullContentType
public boolean getAllowNullContentType()Gets whether to allow an absent content type.- Returns:
- whether to allow an absent content type
-
setAllowNullContentType
public void setAllowNullContentType(boolean flag) Sets whether to allow an absent content type.Defaults to false.
- Parameters:
flag- flag to set
-
validate
Validate the request.- Specified by:
validatein interfaceHttpServletRequestValidator- Parameters:
request- the request to validate- Throws:
ServletException- if the request is determined to be invalid
-