Class JspChecker


  • public class JspChecker
    extends AbstractChecker
    Check JSP/JSPF for bad coding practices.

    Eg. nested foreach, quotes in quote, A name, System.out, getParameter, IMG HTML 5 conformance

    • Field Detail

      • IGNORE_CHECK_I18N

        public static final java.lang.String IGNORE_CHECK_I18N
        Prefix property to allow files or dirs to be excluded from test checkI18N.

        Ex:

        com.jalios.jcms.tools.JspChecker.checkI18N.ignored.{custom-suffix}: plugins/ExcludedPlugin/
        com.jalios.jcms.tools.JspChecker.checkI18N.ignored.{custom-suffix}: plugins/ExcludedPlugin/excludedFile1.jsp, plugins/ExcludedPlugin/excludedFile2.jsp

        See Also:
        Constant Field Values
      • IGNORE_CHECK_NESTED_FOREACH

        public static final java.lang.String IGNORE_CHECK_NESTED_FOREACH
        See Also:
        Constant Field Values
      • IGNORE_ENCODE_HTML_ATTRIBUTES

        public static final java.lang.String IGNORE_ENCODE_HTML_ATTRIBUTES
        See Also:
        Constant Field Values
      • IGNORE_CHECK_QUOTES

        public static final java.lang.String IGNORE_CHECK_QUOTES
        See Also:
        Constant Field Values
      • IGNORE_CHECK_ANAME

        public static final java.lang.String IGNORE_CHECK_ANAME
        See Also:
        Constant Field Values
      • IGNORE_CHECK_SYSOUT

        public static final java.lang.String IGNORE_CHECK_SYSOUT
        See Also:
        Constant Field Values
      • IGNORE_CHECK_GETPARAMETER

        public static final java.lang.String IGNORE_CHECK_GETPARAMETER
        See Also:
        Constant Field Values
      • IGNORE_CHECK_IMAGE

        public static final java.lang.String IGNORE_CHECK_IMAGE
        See Also:
        Constant Field Values
      • IGNORE_CHECK_MODALPICTURE

        public static final java.lang.String IGNORE_CHECK_MODALPICTURE
        See Also:
        Constant Field Values
      • IGNORE_CHECK_ICONSRC

        public static final java.lang.String IGNORE_CHECK_ICONSRC
        See Also:
        Constant Field Values
      • IGNORE_CHECK_JAVABEAN

        public static final java.lang.String IGNORE_CHECK_JAVABEAN
        See Also:
        Constant Field Values
      • IGNORE_CHECK_LEGACYINCLUDES

        public static final java.lang.String IGNORE_CHECK_LEGACYINCLUDES
        See Also:
        Constant Field Values
      • VERIFIED_FOR_SECURITY

        public static final java.lang.String VERIFIED_FOR_SECURITY
        If a JSP line contains this constant, it will be ignored by JspChecker.checkGetParameter()
        See Also:
        Constant Field Values
    • Constructor Detail

      • JspChecker

        public JspChecker()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • checkAll

        public static CheckResult checkAll​(java.io.File webappDir)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • checkGetParameter

        public static void checkGetParameter​(CheckResult result,
                                             CheckedFile file,
                                             CheckerContext checkerContext)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • checkI18N

        public static void checkI18N​(CheckResult result,
                                     CheckedFile file,
                                     CheckerContext checkerContext)
                              throws java.io.IOException
        Checks that JSP/JSPF do not contains invalid I18N properties inside glp("...")
        Throws:
        java.io.IOException
      • checkModalPicture

        public static void checkModalPicture​(CheckResult result,
                                             CheckedFile file,
                                             CheckerContext checkerContext)
                                      throws java.io.IOException
        Checks that a <jalios:modal> picture attribute is valid.
        Parameters:
        result - the CheckResult to update
        file - the checked file
        checkerContext - the CheckerContext
        Throws:
        java.io.IOException
        Since:
        jcms-9.0.0
      • checkIconSrc

        public static void checkIconSrc​(CheckResult result,
                                        CheckedFile file,
                                        CheckerContext checkerContext)
                                 throws java.io.IOException
        Checks that a <jalios:icon> src attribute is valid.
        Parameters:
        result - the CheckResult to update
        file - the checked file
        checkerContext - the CheckerContext
        Throws:
        java.io.IOException
        Since:
        jcms-9.0.0
      • checkJavaBean

        public static void checkJavaBean​(CheckResult result,
                                         CheckedFile file,
                                         CheckerContext checkerContext)
                                  throws java.io.IOException
        Throws:
        java.io.IOException