Class ParserController

  • All Implemented Interfaces:
    TagConstants

    class ParserController
    extends java.lang.Object
    implements TagConstants
    Controller for the parsing of a JSP page.

    The same ParserController instance is used for a JSP page and any JSP segments included by it (via an include directive), where each segment may be provided in standard or XML syntax. This class selects and invokes the appropriate parser for the JSP page and its included segments.

    • Field Detail

      • isXml

        private boolean isXml
      • baseDirStack

        private java.util.Stack<java.lang.String> baseDirStack
      • isEncodingSpecifiedInProlog

        private boolean isEncodingSpecifiedInProlog
      • hasBom

        private boolean hasBom
      • sourceEnc

        private java.lang.String sourceEnc
      • isDefaultPageEncoding

        private boolean isDefaultPageEncoding
      • isTagFile

        private boolean isTagFile
      • directiveOnly

        private boolean directiveOnly
    • Method Detail

      • getCompiler

        public Compiler getCompiler()
      • parse

        public Node.Nodes parse​(java.lang.String inFileName)
                         throws java.io.FileNotFoundException,
                                JasperException,
                                java.io.IOException
        Parses a JSP page or tag file. This is invoked by the compiler.
        Parameters:
        inFileName - The path to the JSP page or tag file to be parsed.
        Throws:
        java.io.FileNotFoundException
        JasperException
        java.io.IOException
      • parse

        public Node.Nodes parse​(java.lang.String inFileName,
                                Node parent,
                                java.net.URL jarFileUrl)
                         throws java.io.FileNotFoundException,
                                JasperException,
                                java.io.IOException
        Processes an include directive with the given path.
        Parameters:
        inFileName - The path to the resource to be included.
        parent - The parent node of the include directive.
        jarFile - The JAR file from which to read the included resource, or null of the included resource is to be read from the filesystem
        Throws:
        java.io.FileNotFoundException
        JasperException
        java.io.IOException
      • parseTagFileDirectives

        public Node.Nodes parseTagFileDirectives​(java.lang.String inFileName)
                                          throws java.io.FileNotFoundException,
                                                 JasperException,
                                                 java.io.IOException
        Extracts tag file directive information from the tag file with the given name. This is invoked by the compiler
        Parameters:
        inFileName - The name of the tag file to be parsed.
        Throws:
        java.io.FileNotFoundException
        JasperException
        java.io.IOException
      • doParse

        private Node.Nodes doParse​(java.lang.String inFileName,
                                   Node parent,
                                   java.net.URL jarFileUrl)
                            throws java.io.FileNotFoundException,
                                   JasperException,
                                   java.io.IOException
        Parses the JSP page or tag file with the given path name.
        Parameters:
        inFileName - The name of the JSP page or tag file to be parsed.
        parent - The parent node (non-null when processing an include directive)
        isTagFile - true if file to be parsed is tag file, and false if it is a regular JSP page
        directivesOnly - true if the file to be parsed is a tag file and we are only interested in the directives needed for constructing a TagFileInfo.
        jarFile - The JAR file from which to read the JSP page or tag file, or null if the JSP page or tag file is to be read from the filesystem
        Throws:
        java.io.FileNotFoundException
        JasperException
        java.io.IOException
      • getJspConfigPageEncoding

        private java.lang.String getJspConfigPageEncoding​(java.lang.String absFileName)
                                                   throws JasperException
        Throws:
        JasperException
      • determineSyntaxAndEncoding

        private void determineSyntaxAndEncoding​(java.lang.String absFileName,
                                                java.util.jar.JarFile jarFile,
                                                java.lang.String jspConfigPageEnc)
                                         throws JasperException,
                                                java.io.IOException
        Determines the syntax (standard or XML) and page encoding properties for the given file, and stores them in the 'isXml' and 'sourceEnc' instance variables, respectively.
        Throws:
        JasperException
        java.io.IOException
      • getPageEncodingFromDirective

        private java.lang.String getPageEncodingFromDirective​(org.xml.sax.Attributes attrs,
                                                              java.lang.String attrName)
      • resolveFileName

        private java.lang.String resolveFileName​(java.lang.String inFileName)
      • getJarFile

        private java.util.jar.JarFile getJarFile​(java.net.URL jarFileUrl)
                                          throws java.io.IOException
        Throws:
        java.io.IOException