Class HtmlScriptValidator

java.lang.Object
io.goobi.viewer.faces.validators.HtmlScriptValidator
All Implemented Interfaces:
Validator<String>, EventListener

public class HtmlScriptValidator extends Object implements Validator<String>
Validates that any input text has no "script" tags.
Author:
Florian Alpers
  • Constructor Details

    • HtmlScriptValidator

      public HtmlScriptValidator()
  • Method Details

    • validate

      public void validate(FacesContext context, UIComponent component, String input) throws ValidatorException

      Throws a ValidatorException with message key validate_error_scriptTag if validate(String) returns false

      Specified by:
      validate in interface Validator<String>
      Throws:
      ValidatorException
    • validate

      public boolean validate(String input)
      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