Class HTMLSanitizer


  • public class HTMLSanitizer
    extends java.lang.Object
    This file contains static methods that are used by JSP EL.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.owasp.html.PolicyFactory POLICY  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String sanitizeHTML​(java.lang.String untrustedHTML)
      Sanitizes unsafe HTML string
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • POLICY

        protected static final org.owasp.html.PolicyFactory POLICY
    • Method Detail

      • sanitizeHTML

        public static java.lang.String sanitizeHTML​(java.lang.String untrustedHTML)
        Sanitizes unsafe HTML string
        Parameters:
        untrustedHTML - - potentially unsafe HTML string
        Returns:
        safe HTML string with allowed elements only. All other elements that are not specified as allowed are removed.