Package io.goobi.viewer.faces.validators
Class HtmlScriptValidator
java.lang.Object
io.goobi.viewer.faces.validators.HtmlScriptValidator
- All Implemented Interfaces:
Validator<String>,EventListener
Validates that any input text has no "script" tags.
- Author:
- Florian Alpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvalidate(FacesContext context, UIComponent component, String input) booleanReturns false if the input string is not blank and contains a script opening tag (disregarding case).
-
Constructor Details
-
HtmlScriptValidator
public HtmlScriptValidator()
-
-
Method Details
-
validate
public void validate(FacesContext context, UIComponent component, String input) throws ValidatorException Throws a
ValidatorExceptionwith message keyvalidate_error_scriptTagifvalidate(String)returns false- Specified by:
validatein interfaceValidator<String>- Throws:
ValidatorException
-
validate
Returns false if the input string is not blank and contains a script opening tag (disregarding case).- Parameters:
input- HTML string to check for script opening tags- Returns:
- true if the input does not contain a script opening tag (i.e. is safe), false if a script tag is detected
-