Class XssProtectionFieldValidator
java.lang.Object
ch.tocco.nice2.persist.core.api.validation.AbstractFieldValidator
ch.tocco.nice2.userbase.impl.validator.XssProtectionFieldValidator
- All Implemented Interfaces:
FieldValidator
Checks any string based field for content which could lead in a XSS-breach.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addMyself
(EntityModel entityModel, FieldModel fieldModel) Implement this method to return true if the Validator should add itself to the FieldModel at hand.void
validate
(Entity entity, FieldModel fieldModel, @Nullable Object fieldValue, FieldValidationResult fieldValidationResult) Methods inherited from class ch.tocco.nice2.persist.core.api.validation.AbstractFieldValidator
getName, validate
-
Constructor Details
-
XssProtectionFieldValidator
public XssProtectionFieldValidator(org.slf4j.Logger log)
-
-
Method Details
-
addMyself
Description copied from interface:FieldValidator
Implement this method to return true if the Validator should add itself to the FieldModel at hand. This method can be useful, if a validator is being used for all field types meeting a certain requirement (e.g. a specific type). The method is called for each field model at application startup when building the entity model.- Specified by:
addMyself
in interfaceFieldValidator
- Overrides:
addMyself
in classAbstractFieldValidator
- Parameters:
entityModel
- the EntityModelfieldModel
- the FieldModel- Returns:
- true to add the Validator to the EntityModel at hand
-
validate
public void validate(Entity entity, FieldModel fieldModel, @Nullable @Nullable Object fieldValue, FieldValidationResult fieldValidationResult) throws PersistException - Specified by:
validate
in classAbstractFieldValidator
- Throws:
PersistException
-