Class ScriptFreeTLV


  • public class ScriptFreeTLV
    extends javax.servlet.jsp.tagext.TagLibraryValidator

    A TagLibraryValidator for enforcing restrictions against the use of JSP scripting elements.

    This TLV supports four initialization parameters, for controlling which of the four types of scripting elements are allowed or prohibited:

    • allowDeclarations: if true, indicates that declaration elements are not prohibited.
    • allowScriptlets: if true, indicates that scriptlets are not prohibited
    • allowExpressions: if true, indicates that top-level expression elements (i.e., expressions not associated with request-time attribute values) are not prohibited.
    • allowRTExpressions: if true, indicates that expression elements associated with request-time attribute values are not prohibited.

    The default value for all for initialization parameters is false, indicating all forms of scripting elements are to be prohibited.

    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptFreeTLV()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setInitParameters​(java.util.Map<java.lang.String,​java.lang.Object> initParms)
      Sets the values of the initialization parameters, as supplied in the TLD.
      javax.servlet.jsp.tagext.ValidationMessage[] validate​(java.lang.String prefix, java.lang.String uri, javax.servlet.jsp.tagext.PageData page)
      Validates a single JSP page.
      private static javax.servlet.jsp.tagext.ValidationMessage[] vmFromString​(java.lang.String message)  
      • Methods inherited from class javax.servlet.jsp.tagext.TagLibraryValidator

        getInitParameters, release
      • Methods inherited from class java.lang.Object

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

      • allowDeclarations

        private boolean allowDeclarations
      • allowScriptlets

        private boolean allowScriptlets
      • allowExpressions

        private boolean allowExpressions
      • allowRTExpressions

        private boolean allowRTExpressions
    • Constructor Detail

      • ScriptFreeTLV

        public ScriptFreeTLV()
    • Method Detail

      • setInitParameters

        public void setInitParameters​(java.util.Map<java.lang.String,​java.lang.Object> initParms)
        Sets the values of the initialization parameters, as supplied in the TLD.
        Overrides:
        setInitParameters in class javax.servlet.jsp.tagext.TagLibraryValidator
        Parameters:
        initParms - a mapping from the names of the initialization parameters to their values, as specified in the TLD.
      • validate

        public javax.servlet.jsp.tagext.ValidationMessage[] validate​(java.lang.String prefix,
                                                                     java.lang.String uri,
                                                                     javax.servlet.jsp.tagext.PageData page)
        Validates a single JSP page.
        Overrides:
        validate in class javax.servlet.jsp.tagext.TagLibraryValidator
        Parameters:
        prefix - the namespace prefix specified by the page for the custom tag library being validated.
        uri - the URI specified by the page for the TLD of the custom tag library being validated.
        page - a wrapper around the XML representation of the page being validated.
        Returns:
        null, if the page is valid; otherwise, a ValidationMessage[] containing one or more messages indicating why the page is not valid.
      • vmFromString

        private static javax.servlet.jsp.tagext.ValidationMessage[] vmFromString​(java.lang.String message)