Class AllowSafeHtmlAttributeConverterWithSave

java.lang.Object
sk.iway.iwcm.system.jpa.AllowSafeHtmlAttributeConverterWithSave
All Implemented Interfaces:
jakarta.persistence.AttributeConverter<String,String>

public class AllowSafeHtmlAttributeConverterWithSave extends Object implements jakarta.persistence.AttributeConverter<String,String>
Retains safe HTML on both database writes and reads, including legacy rows. This explicit protection is independent of the jpaentity HTML bypass. JDBC callers must invoke sanitize(String) themselves; JPA annotations do not apply to native SQL. Use this converter for HTML fragments, not URLs.
  • Constructor Details

    • AllowSafeHtmlAttributeConverterWithSave

      public AllowSafeHtmlAttributeConverterWithSave()
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(String value)
      Specified by:
      convertToDatabaseColumn in interface jakarta.persistence.AttributeConverter<String,String>
    • convertToEntityAttribute

      public String convertToEntityAttribute(String value)
      Specified by:
      convertToEntityAttribute in interface jakarta.persistence.AttributeConverter<String,String>
    • sanitize

      public static String sanitize(String value)
      Applies the shared safe HTML policy without decoding legacy title notation.
      Parameters:
      value - HTML fragment, possibly loaded or saved through JDBC
      Returns:
      sanitized HTML, preserving null